code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public InputFieldDialog(final String LABEL_KEY){
this(I18n.tr("Input"),LABEL_KEY);
}
| Constructs an input field with a generic caption and a specialized label for the field. |
private char readChar() throws IOException {
int x=readByte() & 0xff;
if (x < 0x80) {
return (char)x;
}
else if (x >= 0xe0) {
return (char)(((x & 0xf) << 12) + ((readByte() & 0x3f) << 6) + (readByte() & 0x3f));
}
else {
return (char)(((x & 0x1f) << 6) + (readByte() & 0x3f));
}
}
| Read one character from the input stream. |
public boolean readBoundary() throws IOException {
byte[] marker=new byte[2];
boolean nextChunk=false;
head+=boundaryLength;
marker[0]=readByte();
if (marker[0] == LF) {
return true;
}
marker[1]=readByte();
if (arrayequals(marker,STREAM_TERMINATOR,2)) {
nextChunk=false;
}
else if (arrayequals(marker,FIELD_SEPARATOR,2)) {
nextChunk=true;
}
else {
throw new FileUploadException(MalformedStreamException,"Unexpected characters follow a boundary");
}
return nextChunk;
}
| Skips a <code>boundary</code> token, and checks whether more <code>encapsulations</code> are contained in the stream. |
public void generatePotentialMenuTimes(TimeIncrement timeIncrement,LocalTime optionalStartTime,LocalTime optionalEndTime){
LocalTime startTime=(optionalStartTime == null) ? LocalTime.MIN : optionalStartTime;
LocalTime endTime=(optionalEndTime == null) ? LocalTime.MAX : optionalEndTime;
potentialMenuTimes=new ArrayList<LocalTime>();
int increment=timeIncrement.minutes;
LocalTime entry=LocalTime.MIDNIGHT;
boolean continueLoop=true;
while (continueLoop) {
if (PickerUtilities.isLocalTimeInRange(entry,startTime,endTime,true)) {
potentialMenuTimes.add(entry);
}
entry=entry.plusMinutes(increment);
continueLoop=(!(LocalTime.MIDNIGHT.equals(entry)));
}
}
| generatePotentialMenuTimes, This will generate a list of menu times for populating the combo box menu, using a TimePickerSettings.TimeIncrement value. The menu times will always start at Midnight, and increase according to the increment until the last time before 11:59pm. Note: This function can be called before or after setting an optional veto policy. Vetoed times will never be added to the time picker menu, regardless of whether they are generated by this function. Example usage: generatePotentialMenuTimes(TimeIncrement.FifteenMinutes); Number of entries: If no veto policy has been created, the number of entries in the drop down menu would be determined by the size of the increment as follows; FiveMinutes has 288 entries. TenMinutes has 144 entries. FifteenMinutes has 96 entries. TwentyMinutes has 72 entries. ThirtyMinutes has 48 entries. OneHour has 24 entries. |
@Override public void updateFinished(){
determineNumberOfClusters();
}
| Singals the end of the updating. |
private static void renumProviders(){
Provider[] p=Services.getProviders();
for (int i=0; i < p.length; i++) {
p[i].setProviderNumber(i + 1);
}
}
| Update sequence numbers of all providers. |
public boolean isOk(){
return this.ok;
}
| isOk: Get validation state |
public void sessionDestroyed(HttpSessionEvent event){
String nativeId=event.getSession().getId();
try {
String sessionId=SessionCachingFilter.getSessionManager().destroyNativeSession(nativeId);
LOG.debug("Received sessionDestroyed event for native session {} (wrapped by {})",nativeId,sessionId);
}
catch ( DistributedSystemDisconnectedException dex) {
LOG.debug("Cache disconnected - unable to destroy native session {0}",nativeId);
}
}
| This will receive events from the container using the native sessions. |
public boolean isNfsMountCreationRequired(){
return nfsMountCreationRequired;
}
| Gets the value of the nfsMountCreationRequired property. |
public void addFillOutsideLine(FillOutsideLine fill){
mFillBelowLine.add(fill);
}
| Sets if the line chart should be filled outside its line. Filling outside with FillOutsideLine.INTEGRAL the line transforms a line chart into an area chart. |
public void requestAutoFocus(Handler handler,int message){
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler,message);
camera.autoFocus(autoFocusCallback);
}
}
| Asks the camera hardware to perform an autofocus. |
public static ComponentRelationshipBuilder component(String componentName){
return new ComponentRelationshipBuilder(componentName);
}
| Create a ComponentRelationshipBuilder. |
public static final String format(ReadOnlyVector3 vec){
if (vec == null) {
return ("");
}
return (String.format(Landscape.stringFormat,vec.getX()) + "," + String.format(Landscape.stringFormat,vec.getY())+ ","+ String.format(Landscape.stringFormat,vec.getZ()));
}
| Format a Vector3. |
void sendMessage(ChannelData channelData,TransportAddress srcAddr,TransportAddress remoteAddr) throws IllegalArgumentException, IOException, StunException {
boolean pad=srcAddr.getTransport() == Transport.TCP || srcAddr.getTransport() == Transport.TLS;
sendMessage(channelData.encode(pad),srcAddr,remoteAddr);
}
| Sends the specified stun message through the specified access point. |
public static LazyPStackX<Integer> range(int start,int end){
return fromStreamS(ReactiveSeq.range(start,end));
}
| Create a LazyPStackX that contains the Integers between start and end |
public UnchangeableAllowingOnBehalfActingException(String message,ApplicationExceptionBean bean,Throwable cause){
super(message,bean,cause);
}
| Constructs a new exception with the specified detail message, cause, and bean for JAX-WS exception serialization. |
public static Complex conjugate(Complex c){
return new Complex(c.real,-c.imag);
}
| Conjugates a complex number. |
public JRadioButtonMenuItem(String text,boolean selected){
this(text);
setSelected(selected);
}
| Creates a radio button menu item with the specified text and selection state. |
private static void appendNamedParameter(StringBuffer sb,String name,Object value){
if (value != null) {
sb.append(name).append("=\"").append(value).append("\" ");
}
}
| Appends the name and the value of an Object to a StringBuffer. |
public void addValue(String key,BigDecimal val,String comment) throws HeaderCardException {
addHeaderCard(key,new HeaderCard(key,val,comment));
}
| Add or replace a key with the given bigdecimal value and comment. Note that float values will be promoted to doubles. |
public static void clearCache(){
initCache();
m_Cache.clear();
}
| clears the cache for class/classnames queries. |
@Override public final boolean hasStableIds(){
return true;
}
| Adapter must have stable id |
public static Element createElementInEncryptionSpace(Document doc,String elementName){
if (doc == null) {
throw new RuntimeException("Document is null");
}
if ((xencPrefix == null) || (xencPrefix.length() == 0)) {
return doc.createElementNS(EncryptionConstants.EncryptionSpecNS,elementName);
}
return doc.createElementNS(EncryptionConstants.EncryptionSpecNS,xencPrefix + ":" + elementName);
}
| Creates an Element in the XML Encryption specification namespace. |
public int calcColumnWidth(int col){
return calcColumnWidth(getJTable(),col);
}
| calcs the optimal column width of the given column |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException {
return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
| Execute the function. The function must return a valid object. |
public static boolean isControlCharacter(char c){
return c < 32 || c == 127;
}
| Checks if a particular character is a control character, in Lanterna this currently means it's 0-31 or 127 in the ascii table. |
@SuppressWarnings("unchecked") public T withResult(Object result){
response.result=result;
return (T)this;
}
| Sets the operation response result. |
public static String convertExchangeShortNameToClassname(String shortExchangeName){
if (BITSTAMP_EXCHANGE_NAME.equalsIgnoreCase(shortExchangeName)) {
return BitstampExchange.class.getName();
}
else if (BTCE_EXCHANGE_NAME.equalsIgnoreCase(shortExchangeName)) {
return BTCEExchange.class.getName();
}
else if (CAMPBX_EXCHANGE_NAME.equalsIgnoreCase(shortExchangeName)) {
return CampBXExchange.class.getName();
}
else if (OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(shortExchangeName)) {
return OERExchange.class.getName();
}
else if (VIRTEX_EXCHANGE_NAME.equalsIgnoreCase(shortExchangeName)) {
return VirtExExchange.class.getName();
}
else {
return null;
}
}
| Convert an exchange short name into a classname that can be used to create an Exchange. |
public SQLNonTransientConnectionException(String reason,String sqlState,Throwable cause){
super(reason,sqlState,cause);
}
| Creates an SQLNonTransientConnectionException object. The Reason string is set to the given reason string, the SQLState string is set to the given SQLState string and the cause Throwable object is set to the given cause Throwable object. |
private void tryScrollBackToTopAbortRefresh(){
tryScrollBackToTop();
}
| just make easier to understand |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:30.780 -0500",hash_original_method="373B413D23312B4F586E9709CD9454D3",hash_generated_method="4885D96B2E3A8FE3ADAF1F0D12C568CC") private static String displayNameFor(int off){
off=off / 1000 / 60;
char[] buf=new char[9];
buf[0]='G';
buf[1]='M';
buf[2]='T';
if (off < 0) {
buf[3]='-';
off=-off;
}
else {
buf[3]='+';
}
int hours=off / 60;
int minutes=off % 60;
buf[4]=(char)('0' + hours / 10);
buf[5]=(char)('0' + hours % 10);
buf[6]=':';
buf[7]=(char)('0' + minutes / 10);
buf[8]=(char)('0' + minutes % 10);
return new String(buf);
}
| Provides the name of the algorithmic time zone for the specified offset. Taken from TimeZone.java. |
public static Integer evictionPolicyMaxSize(@Nullable EvictionPolicy plc){
if (plc instanceof LruEvictionPolicyMBean) return ((LruEvictionPolicyMBean)plc).getMaxSize();
if (plc instanceof RandomEvictionPolicyMBean) return ((RandomEvictionPolicyMBean)plc).getMaxSize();
if (plc instanceof FifoEvictionPolicyMBean) return ((FifoEvictionPolicyMBean)plc).getMaxSize();
return null;
}
| Extract max size from eviction policy if available. |
public void fillInInvokerStackTrace(){
getCause().setStackTrace(Thread.currentThread().getStackTrace());
}
| We were created in a thread that is not related to the remote that called the method. This allows us to see the stack trace of the invoker. |
public String pullRequestsUrl(String account,String collection,String repoId){
Objects.requireNonNull(repoId,"Repository id required");
return getTeamBaseUrl(account,collection) + format(PULL_REQUESTS,repoId) + getApiVersion();
}
| Returns the url for pull requests. |
@Override public synchronized boolean equals(Object object){
if (this == object) {
return true;
}
if (object instanceof List) {
List<?> list=(List<?>)object;
if (list.size() != elementCount) {
return false;
}
int index=0;
Iterator<?> it=list.iterator();
while (it.hasNext()) {
Object e1=elementData[index++], e2=it.next();
if (!(e1 == null ? e2 == null : e1.equals(e2))) {
return false;
}
}
return true;
}
return false;
}
| Compares the specified object to this vector and returns if they are equal. The object must be a List which contains the same objects in the same order. |
private void processAnsiCommandCharacter(char ansiCommandCharacter){
switch (ansiCommandCharacter) {
case '@':
processAnsiCommand_atsign();
break;
case 'A':
processAnsiCommand_A();
break;
case 'B':
processAnsiCommand_B();
break;
case 'C':
processAnsiCommand_C();
break;
case 'D':
processAnsiCommand_D();
break;
case 'd':
processAnsiCommand_d();
break;
case 'E':
processAnsiCommand_E();
break;
case 'F':
processAnsiCommand_F();
break;
case 'G':
processAnsiCommand_G();
break;
case 'H':
processAnsiCommand_H();
break;
case 'h':
processAnsiCommand_h();
break;
case 'J':
processAnsiCommand_J();
break;
case 'K':
processAnsiCommand_K();
break;
case 'L':
processAnsiCommand_L();
break;
case 'l':
processAnsiCommand_l();
break;
case 'M':
processAnsiCommand_M();
break;
case 'm':
processAnsiCommand_m();
break;
case 'n':
processAnsiCommand_n();
break;
case 'P':
processAnsiCommand_P();
break;
case 'r':
processAnsiCommand_r();
break;
case 'S':
processAnsiCommand_S();
break;
case 'T':
processAnsiCommand_T();
break;
case 'X':
break;
case 'Z':
break;
default :
Logger.log("Ignoring unsupported ANSI command character: '" + ansiCommandCharacter + "'");
break;
}
}
| This method dispatches control to various processing methods based on the command character found in the most recently received ANSI escape sequence. This method only handles command characters that follow the ANSI standard Control Sequence Introducer (CSI), which is "\e[...", where "..." is an optional ';'-separated sequence of numeric parameters. <p> |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(string);
}
catch ( IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode='k';
}
this.comma=true;
return this;
}
throw new JSONException("Value out of sequence.");
}
| Append a value. |
public DatagramReader(final byte[] byteArray){
byteStream=new ByteArrayInputStream(Arrays.copyOf(byteArray,byteArray.length));
currentByte=0;
currentBitIndex=-1;
}
| Creates a new reader for an array of bytes. |
public synchronized Stream<Map.Entry<ID,Type>> stream(){
return registered.entrySet().stream();
}
| Return the stream of the underlying Registrar hashmap. Use this to directly manipulate the registrar |
public void simulateMethod(SootMethod method,ReferenceVariable thisVar,ReferenceVariable returnVar,ReferenceVariable params[]){
String subSignature=method.getSubSignature();
{
defaultMethod(method,thisVar,returnVar,params);
return;
}
}
| Implements the abstract method simulateMethod. It distributes the request to the corresponding methods by signatures. |
protected int availableIDsSize(){
return this.idsAvailable.size();
}
| Caller must hold the rwLock |
public void list(){
Iterator<String> iter=lastNames.iterator();
while (iter.hasNext()) {
System.out.println(iter.next());
}
System.out.println();
iter=doubleLastNames.iterator();
while (iter.hasNext()) {
System.out.println(iter.next());
}
System.out.println();
iter=firstNames.iterator();
while (iter.hasNext()) {
System.out.println(iter.next());
}
System.out.println();
}
| A function for debugging, list out all the recorded name character |
MutableBigInteger divideKnuth(MutableBigInteger b,MutableBigInteger quotient,boolean needRemainder){
if (b.intLen == 0) throw new ArithmeticException("BigInteger divide by zero");
if (intLen == 0) {
quotient.intLen=quotient.offset=0;
return needRemainder ? new MutableBigInteger() : null;
}
int cmp=compare(b);
if (cmp < 0) {
quotient.intLen=quotient.offset=0;
return needRemainder ? new MutableBigInteger(this) : null;
}
if (cmp == 0) {
quotient.value[0]=quotient.intLen=1;
quotient.offset=0;
return needRemainder ? new MutableBigInteger() : null;
}
quotient.clear();
if (b.intLen == 1) {
int r=divideOneWord(b.value[b.offset],quotient);
if (needRemainder) {
if (r == 0) return new MutableBigInteger();
return new MutableBigInteger(r);
}
else {
return null;
}
}
if (intLen >= KNUTH_POW2_THRESH_LEN) {
int trailingZeroBits=Math.min(getLowestSetBit(),b.getLowestSetBit());
if (trailingZeroBits >= KNUTH_POW2_THRESH_ZEROS * 32) {
MutableBigInteger a=new MutableBigInteger(this);
b=new MutableBigInteger(b);
a.rightShift(trailingZeroBits);
b.rightShift(trailingZeroBits);
MutableBigInteger r=a.divideKnuth(b,quotient);
r.leftShift(trailingZeroBits);
return r;
}
}
return divideMagnitude(b,quotient,needRemainder);
}
| Calculates the quotient of this div b and places the quotient in the provided MutableBigInteger objects and the remainder object is returned. Uses Algorithm D in Knuth section 4.3.1. Many optimizations to that algorithm have been adapted from the Colin Plumb C library. It special cases one word divisors for speed. The content of b is not changed. |
public void applyComponentOrientation(ComponentOrientation o){
possiblyFixCursor(o.isLeftToRight());
super.applyComponentOrientation(o);
}
| Overridden to ensure that the cursor for this component is appropriate for the orientation. |
public RandomBallCoverOneShot(List<V> vecs,DistanceMetric dm,int s,ExecutorService execServ){
this.dm=dm;
this.s=s;
this.allVecs=new ArrayList<V>(vecs);
if (execServ instanceof FakeExecutor) distCache=dm.getAccelerationCache(allVecs);
else distCache=dm.getAccelerationCache(vecs,execServ);
IntList allIndices=new IntList(allVecs.size());
ListUtils.addRange(allIndices,0,allVecs.size(),1);
try {
setUp(allIndices,execServ);
}
catch ( InterruptedException ex) {
try {
setUp(allIndices,new FakeExecutor());
}
catch ( InterruptedException ex1) {
}
}
}
| Creates a new one-shot version of the Random Cover Ball. |
public static Bitmap createThumbnailBitmap(Context context,Uri mediaUri,int maxThumbWidth,int maxThumbHeight){
Bitmap thumbnailBitmap=null;
ResourceUtils.Resource resource=ResourceUtils.openResource(context,mediaUri,null);
if (null == resource) {
return null;
}
try {
BitmapFactory.Options options=new BitmapFactory.Options();
options.inPreferredConfig=Bitmap.Config.ARGB_8888;
resource=ResourceUtils.openResource(context,mediaUri,null);
Bitmap fullSizeBitmap=null;
if (null != resource) {
try {
fullSizeBitmap=BitmapFactory.decodeStream(resource.mContentStream,null,options);
}
catch ( Exception e) {
Log.e(LOG_TAG,"BitmapFactory.decodeStream fails " + e.getLocalizedMessage());
}
}
if (null != fullSizeBitmap) {
if ((fullSizeBitmap.getHeight() < maxThumbHeight) && (fullSizeBitmap.getWidth() < maxThumbWidth)) {
thumbnailBitmap=fullSizeBitmap;
}
else {
double thumbnailWidth=maxThumbWidth;
double thumbnailHeight=maxThumbHeight;
double imageWidth=fullSizeBitmap.getWidth();
double imageHeight=fullSizeBitmap.getHeight();
if (imageWidth > imageHeight) {
thumbnailHeight=thumbnailWidth * imageHeight / imageWidth;
}
else {
thumbnailWidth=thumbnailHeight * imageWidth / imageHeight;
}
try {
thumbnailBitmap=Bitmap.createScaledBitmap((null == fullSizeBitmap) ? thumbnailBitmap : fullSizeBitmap,(int)thumbnailWidth,(int)thumbnailHeight,false);
}
catch ( OutOfMemoryError ex) {
Log.e(LOG_TAG,"createThumbnailBitmap " + ex.getMessage());
}
}
if (null != fullSizeBitmap) {
fullSizeBitmap.recycle();
System.gc();
}
}
if (null != resource) {
resource.mContentStream.close();
}
}
catch ( Exception e) {
Log.e(LOG_TAG,"createThumbnailBitmap fails " + e.getLocalizedMessage());
}
return thumbnailBitmap;
}
| Creates a thumbnail bitmap from a media Uri |
public OsmoseBug(){
open();
}
| Used for when parsing API output |
@Override public String toString(){
return this.name;
}
| Returns a string representing the object. |
public Swagger2MarkupConfig build(){
buildNaturalOrdering();
return config;
}
| Builds the Swagger2MarkupConfig. |
public void moveTo(int x,int y){
Rectangle r=getBounds();
translate(x - r.x,y - r.y);
}
| Sets bounding box of all elements in group at (x, y) |
public boolean submitNoWake(Runnable task){
ClassLoader loader=Thread.currentThread().getContextClassLoader();
boolean isPriority=false;
boolean isQueue=true;
boolean isWake=false;
return scheduleImpl(task,loader,MAX_EXPIRE,isPriority,isQueue,isWake);
}
| Submit a task, but do not wake the scheduler |
private void updateMenu(){
this.removeAll();
for ( WorkspaceComponent component : workspace.getComponentList()) {
JMenu componentMenu=new JMenu(component.getName());
for ( PotentialConsumer potentialConsumer : component.getPotentialConsumers()) {
if (potentialConsumer.getDataType() == producer.getDataType()) {
CouplingMenuItem menuItem=new CouplingMenuItem(workspace,potentialConsumer.getDescription(),producer,potentialConsumer);
componentMenu.add(menuItem);
}
}
this.add(componentMenu);
}
}
| Update the menu to reflect current configuration of components in the workspace. |
@Override public int doStartTag() throws JspException {
i=0;
return EVAL_BODY_BUFFERED;
}
| Process start tag |
@DSSpec(DSCat.IO) @DSSource({DSSourceKind.IO}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:52.765 -0400",hash_original_method="C68A979C97C9773BF4E1D97780D466BC",hash_generated_method="ABED2FB5692629886742AFEF5BC17E85") public void readFully(byte[] data,int offset,int length) throws IOException, EOFException {
int remaining=length;
while (remaining > 0) {
int location=offset + length - remaining;
int count=read(data,location,remaining);
if (-1 == count) {
throw new EOFException();
}
remaining-=count;
}
}
| Invokes the delegate's <code>read(byte[] data, int, int)</code> method. |
public void focusLost(FocusEvent e){
((FocusListener)a).focusLost(e);
((FocusListener)b).focusLost(e);
}
| Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b. |
@Override protected EClass eStaticClass(){
return EipPackage.Literals.ROUTE;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
protected void basicCheck(Environment env) throws ClassNotFound {
if (tracing) env.dtEnter("BinaryClass.basicCheck: " + getName());
if (basicChecking || basicCheckDone) {
if (tracing) env.dtExit("BinaryClass.basicCheck: OK " + getName());
return;
}
if (tracing) env.dtEvent("BinaryClass.basicCheck: CHECKING " + getName());
basicChecking=true;
super.basicCheck(env);
if (doInheritanceChecks) {
collectInheritedMethods(env);
}
basicCheckDone=true;
basicChecking=false;
if (tracing) env.dtExit("BinaryClass.basicCheck: " + getName());
}
| Ready a BinaryClass for further checking. Note that, until recently, BinaryClass relied on the default basicCheck() provided by ClassDefinition. The definition here has been added to ensure that the information generated by collectInheritedMethods is available for BinaryClasses. |
public AnnotationFS add(AnnotationFS aOriginFs,AnnotationFS aTargetFs,JCas aJCas,int aStart,int aEnd,AnnotationFeature aFeature,Object aLabelValue) throws BratAnnotationException {
if (crossMultipleSentence || isSameSentence(aJCas,aOriginFs.getBegin(),aTargetFs.getEnd())) {
return interalAddToCas(aJCas,aStart,aEnd,aOriginFs,aTargetFs,aLabelValue,aFeature);
}
else {
throw new ArcCrossedMultipleSentenceException("Arc Annotation shouldn't cross sentence boundary");
}
}
| Update the CAS with new/modification of arc annotations from brat |
public long size(){
long size=0;
for (int x=0; x < trees.length; x++) size+=trees[x].child.numNodes(GPNode.NODESEARCH_ALL);
return size;
}
| Returns the "size" of the individual, namely, the number of nodes in all of its subtrees. |
public ApplicationExceptionBean(ApplicationExceptionBean template){
setId(template.getId());
setCauseStackTrace(template.getCauseStackTrace());
setMessageKey(template.getMessageKey());
setMessageParams(template.getMessageParams());
}
| Instantiates an <code>ApplicationExceptionBean</code> based on the specified template. The exception ID, causing stack trace, message key, and message parameters are copied from the template. |
private static Node createNode(final Graph2D graph2D,final INaviViewNode node){
if (node instanceof INaviGroupNode) {
return ((INaviGroupNode)node).isCollapsed() ? graph2D.getHierarchyManager().createFolderNode(graph2D) : graph2D.getHierarchyManager().createGroupNode(graph2D);
}
else {
return graph2D.createNode();
}
}
| Creates a new yfiles graph node. |
public void addPrefix(String prefix,String uri){
namespaces.put(prefix,uri);
this.prefix.put(uri,prefix);
}
| Add a namespace prefix and namespace name to context. |
@Override public void test() throws ParameterException {
if (!list.isDefined() || !length.isDefined()) {
return;
}
if (list.size() != length.intValue()) {
throw new WrongParameterValueException("Global Parameter Constraint Error." + "\nThe size of the list parameter \"" + list.getName() + "\" must be "+ length.getValue()+ ", current size is "+ list.size()+ ". The value is defined by the integer parameter "+ length.getName()+ ".\n");
}
}
| Checks is the size of the list parameter is equal to the constraint list size specified. If not, a parameter exception is thrown. |
public InlineQueryResultVoice.InlineQueryResultVoiceBuilder title(String title){
this.title=title;
return this;
}
| *Required Sets the title to the provided value |
private List<DiffEntry> commitToCommit(String commitAId,String commitBId,DiffFormatter formatter) throws IOException {
if (commitAId == null) {
commitAId=Constants.HEAD;
}
ObjectId commitA=repository.resolve(commitAId);
if (commitA == null) {
throw new IllegalArgumentException("Invalid commit id " + commitAId);
}
ObjectId commitB=repository.resolve(commitBId);
if (commitB == null) {
throw new IllegalArgumentException("Invalid commit id " + commitBId);
}
RevTree treeA;
try (RevWalk revWalkA=new RevWalk(repository)){
treeA=revWalkA.parseTree(commitA);
}
RevTree treeB;
try (RevWalk revWalkB=new RevWalk(repository)){
treeB=revWalkB.parseTree(commitB);
}
if (!request.isNoRenames()) {
formatter.setDetectRenames(true);
int renameLimit=request.getRenameLimit();
if (renameLimit > 0) {
formatter.getRenameDetector().setRenameLimit(renameLimit);
}
}
return formatter.scan(treeA,treeB);
}
| Show changes between specified two revisions and index. If <code>commitAId == null</code> then view changes between HEAD and revision commitBId. |
@Override public void writeBatch() throws IOException {
if (getInstances() == null) {
throw new IOException("No instances to save");
}
if (getRetrieval() == INCREMENTAL) {
throw new IOException("Batch and incremental saving cannot be mixed.");
}
setRetrieval(BATCH);
setWriteMode(WRITE);
if ((retrieveFile() == null) && (getWriter() == null)) {
for (int i=0; i < getInstances().numInstances(); i++) {
System.out.println(instanceToSvmlight(getInstances().instance(i)));
}
setWriteMode(WAIT);
}
else {
PrintWriter outW=new PrintWriter(getWriter());
for (int i=0; i < getInstances().numInstances(); i++) {
outW.println(instanceToSvmlight(getInstances().instance(i)));
}
outW.flush();
outW.close();
setWriteMode(WAIT);
outW=null;
resetWriter();
setWriteMode(CANCEL);
}
}
| Writes a Batch of instances. |
public void loadLocal(final int local){
loadInsn(getLocalType(local),local);
}
| Generates the instruction to load the given local variable on the stack. |
private void testArrayAndOther(OverloadedMethodsSubset oms){
assertEquals(Serializable.class,oms.getCommonSupertypeForUnwrappingHint(int[].class,String.class));
assertEquals(Serializable.class,oms.getCommonSupertypeForUnwrappingHint(Object[].class,String.class));
assertEquals(Object.class,oms.getCommonSupertypeForUnwrappingHint(int[].class,List.class));
assertEquals(Object.class,oms.getCommonSupertypeForUnwrappingHint(Object[].class,List.class));
assertEquals(int[].class,oms.getCommonSupertypeForUnwrappingHint(int[].class,int[].class));
assertEquals(Object[].class,oms.getCommonSupertypeForUnwrappingHint(Object[].class,Object[].class));
}
| These will be the same with fixed and buggy: |
private void addNewAccessor(final ITypeBinding type,final IVariableBinding field,final String contents,final ListRewrite rewrite,final ASTNode insertion){
final String delimiter=StubUtility.getLineDelimiterUsed();
final MethodDeclaration declaration=(MethodDeclaration)rewrite.getASTRewrite().createStringPlaceholder(CodeFormatterUtil.format(CodeFormatter.K_CLASS_BODY_DECLARATIONS,contents,0,delimiter),ASTNode.METHOD_DECLARATION);
if (insertion != null) rewrite.insertBefore(declaration,insertion,null);
else rewrite.insertLast(declaration,null);
}
| Adds a new accessor for the specified field. |
public Rectangle2D createProperBounds(double x1,double y1,double x2,double y2){
double x=Math.min(x1,x2);
double y=Math.min(y1,y2);
double w=Math.abs(x1 - x2);
double h=Math.abs(y1 - y2);
return new Rectangle2D.Double(x,y,w,h);
}
| Create a bounding rectangle given the four coordinates, where the upper left corner of the rectangle is the minimum x, y values and the width and height are the difference between xs and ys. |
public void revert(){
orientation=orientation == RIGHT ? LEFT : RIGHT;
}
| Reverts the orientation |
PrefixExpression(AST ast){
super(ast);
}
| Creates a new AST node for an prefix expression owned by the given AST. By default, the node has unspecified (but legal) operator and operand. |
static int svd_imin(int a,int b){
return Math.min(a,b);
}
| returns the smaller of two integers |
public ColladaAccessor(String ns){
super(ns);
}
| Create a new accessor. |
public synchronized int lastIndexOf(Object object,int location){
if (location < elementCount) {
if (object != null) {
for (int i=location; i >= 0; i--) {
if (object.equals(elementData[i])) {
return i;
}
}
}
else {
for (int i=location; i >= 0; i--) {
if (elementData[i] == null) {
return i;
}
}
}
return -1;
}
throw arrayIndexOutOfBoundsException(location,elementCount);
}
| Searches in this vector for the index of the specified object. The search for the object starts at the specified location and moves towards the start of this vector. |
public static synchronized X509CertImpl intern(X509Certificate c) throws CertificateException {
if (c == null) {
return null;
}
boolean isImpl=c instanceof X509CertImpl;
byte[] encoding;
if (isImpl) {
encoding=((X509CertImpl)c).getEncodedInternal();
}
else {
encoding=c.getEncoded();
}
X509CertImpl newC=getFromCache(certCache,encoding);
if (newC != null) {
return newC;
}
if (isImpl) {
newC=(X509CertImpl)c;
}
else {
newC=new X509CertImpl(encoding);
encoding=newC.getEncodedInternal();
}
addToCache(certCache,encoding,newC);
return newC;
}
| Return an interned X509CertImpl for the given certificate. If the given X509Certificate or X509CertImpl is already present in the cert cache, the cached object is returned. Otherwise, if it is a X509Certificate, it is first converted to a X509CertImpl. Then the X509CertImpl is added to the cache and returned. Note that all certificates created via generateCertificate(InputStream) are already interned and this method does not need to be called. It is useful for certificates that cannot be created via generateCertificate() and for converting other X509Certificate implementations to an X509CertImpl. |
protected void checkSlice(int slice){
if (slice < 0 || slice >= slices) throw new IndexOutOfBoundsException("Attempted to access " + toStringShort() + " at slice="+ slice);
}
| Sanity check for operations requiring a slice index to be within bounds. |
public static float rotateX(float pX,float pY,float cX,float cY,float angleInDegrees){
double angle=Math.toRadians(angleInDegrees);
return (float)(Math.cos(angle) * (pX - cX) - Math.sin(angle) * (pY - cY) + cX);
}
| Rotate point P around center point C. |
private BaseToken fetchTokenLocal(TokenOnWire tw){
BaseToken verificationToken=null;
URI tkId=tw.getTokenId();
if (!tw.isProxyToken()) {
verificationToken=_dbClient.queryObject(Token.class,tkId);
if (null != verificationToken && !checkExpiration(((Token)verificationToken),true)) {
_log.warn("Token found in database but is expired: {}",verificationToken.getId());
return null;
}
}
else {
verificationToken=_dbClient.queryObject(ProxyToken.class,tkId);
if (null != verificationToken && !checkExpiration((ProxyToken)verificationToken)) {
_log.warn("ProxyToken found in database but is expired: {}",verificationToken.getId());
return null;
}
}
if (verificationToken == null) {
_log.error("Could not find token with id {} for validation",tkId);
}
return verificationToken;
}
| Retrieves a token and checks expiration |
public SignatureVisitor visitSuperclass(){
return this;
}
| Visits the type of the super class. |
public byte byteValue(){
return toNumber().byteValue();
}
| Returns the value of the specified Variant as a <code>byte</code>. This may involve rounding or truncation. |
public static EqualityExpression eq(String propertyName,Object value){
return new EqualityExpression(Operator.EQUAL,propertyName,value);
}
| Apply an "equal" constraint to the named property |
public CtClass makeNestedClass(String name,boolean isStatic){
throw new RuntimeException(getName() + " is not a class");
}
| Makes a new public nested class. If this method is called, the <code>CtClass</code>, which encloses the nested class, is modified since a class file includes a list of nested classes. <p>The current implementation only supports a static nested class. <code>isStatic</code> must be true. |
public int processBlock(byte[] in,int inOff,byte[] out,int outOff) throws DataLengthException, IllegalStateException {
return (encrypting) ? encryptBlock(in,inOff,out,outOff) : decryptBlock(in,inOff,out,outOff);
}
| Process one block of input from the array in and write it to the out array. |
public boolean containsProperly(Geometry g){
if (!baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal())) return false;
return baseGeom.relate(g,"T**FF*FF*");
}
| Default implementation. |
public AbstractLocalContainerStub(){
}
| Allows creating a container with no configuration for test that do not require a configuration. |
public GlowInventoryView(HumanEntity player,Inventory top){
this(player,top.getType(),top,player.getInventory());
}
| Create an inventory view for this player looking at a given top inventory. |
public NotificationChain basicSetReturnTypeRef(TypeRef newReturnTypeRef,NotificationChain msgs){
TypeRef oldReturnTypeRef=returnTypeRef;
returnTypeRef=newReturnTypeRef;
if (eNotificationRequired()) {
ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,TypesPackage.TFUNCTION__RETURN_TYPE_REF,oldReturnTypeRef,newReturnTypeRef);
if (msgs == null) msgs=notification;
else msgs.add(notification);
}
return msgs;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void navigateToHome(Context context){
if (context != null) {
context.startActivity(new Intent(context,HomeActivity.class));
}
}
| Goes to the user details screen. |
public void readExif(String inFileName) throws FileNotFoundException, IOException {
if (inFileName == null) {
throw new IllegalArgumentException(NULL_ARGUMENT_STRING);
}
InputStream is=null;
try {
is=(InputStream)new BufferedInputStream(new FileInputStream(inFileName));
readExif(is);
}
catch ( IOException e) {
closeSilently(is);
throw e;
}
is.close();
}
| Reads the exif tags from a file, clearing this ExifInterface object's existing exif tags. |
@Override protected void doPost(HttpServletRequest request,HttpServletResponse response){
processGetRequest(request,response);
}
| Handles the HTTP <code>POST</code> method. |
public DOTGenerator(Grammar grammar){
this.grammar=grammar;
}
| This aspect is associated with a grammar |
private void checkSenderStillAlive(PartitionedRegion r,InternalDistributedMember sender){
if (!r.getDistributionAdvisor().containsId(sender)) {
r.getRedundancyProvider().finishIncompleteBucketCreation(this.bucketId);
}
}
| Check that sender is still a participant in the partitioned region. If not, notify other nodes to create backup buckets |
public synchronized long ensureThreadId(){
if (DEBUG || DELETEDEBUG) {
LogTag.debug("ensureThreadId before: " + mThreadId);
}
if (mThreadId <= 0) {
mThreadId=getOrCreateThreadId(mContext,mRecipients);
}
if (DEBUG || DELETEDEBUG) {
LogTag.debug("ensureThreadId after: " + mThreadId);
}
return mThreadId;
}
| Guarantees that the conversation has been created in the database. This will make a blocking database call if it hasn't. |
private void initActions(){
getActionMap().put(UndoAction.ID,undo.getUndoAction());
getActionMap().put(RedoAction.ID,undo.getRedoAction());
}
| Initializes view specific actions. |
public static byte[] calculateAgreement(byte[] ourPrivate,byte[] theirPublic){
byte[] agreement=new byte[32];
scalarmult.crypto_scalarmult(agreement,ourPrivate,theirPublic);
return agreement;
}
| Calculating DH agreement |
public void testConstrIntMathContext(){
int a=732546982;
int precision=21;
RoundingMode rm=RoundingMode.CEILING;
MathContext mc=new MathContext(precision,rm);
String res="732546982";
int resScale=0;
BigDecimal result=new BigDecimal(a,mc);
assertEquals("incorrect value",res,result.unscaledValue().toString());
assertEquals("incorrect scale",resScale,result.scale());
}
| new BigDecimal(int, MathContext) |
public boolean isVlanOverrideAllowed(){
return vlanOverrideAllowed;
}
| Gets the value of the vlanOverrideAllowed property. |
public SilentExit(){
this(1);
}
| SilentExit with default exit code 1. |
public static String join(boolean[] self,String separator){
StringBuilder buffer=new StringBuilder();
boolean first=true;
if (separator == null) separator="";
for ( boolean next : self) {
if (first) {
first=false;
}
else {
buffer.append(separator);
}
buffer.append(next);
}
return buffer.toString();
}
| Concatenates the string representation of each items in this array, with the given String as a separator between each item. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.