code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public String flatten(String model,String models){
return getFlattened(deserialize(model),deserialize(models));
}
| Get a schema schema in "flattened" form whereby all dependent references are resolved and included as inline schema definitions |
public Builder preProcessor(BitmapProcessor preProcessor){
this.preProcessor=preProcessor;
return this;
}
| Sets bitmap processor which will be process bitmaps before they will be cached in memory. So memory cache will contain bitmap processed by incoming preProcessor.<br /> Image will be pre-processed even if caching in memory is disabled. |
public Boolean isThinProvisioned(){
return thinProvisioned;
}
| Gets the value of the thinProvisioned property. |
public String toString(){
return super.toString() + "\nOverdraft limit: $" + String.format("%.2f",overdraftLimit);
}
| Return a String decription of CheckingAccount class |
public void startElement(String ns,String localName,String name,Attributes atts) throws org.xml.sax.SAXException {
Element elem;
if ((null == ns) || (ns.length() == 0)) elem=m_doc.createElementNS(null,name);
else elem=m_doc.createElementNS(ns,name);
append(elem);
try {
int nAtts=atts.getLength();
if (0 != nAtts) {
for (int i=0; i < nAtts; i++) {
if (atts.getType(i).equalsIgnoreCase("ID")) setIDAttribute(atts.getValue(i),elem);
String attrNS=atts.getURI(i);
if ("".equals(attrNS)) attrNS=null;
String attrQName=atts.getQName(i);
if (attrQName.startsWith("xmlns:")) attrNS="http://www.w3.org/2000/xmlns/";
elem.setAttributeNS(attrNS,attrQName,atts.getValue(i));
}
}
m_elemStack.push(elem);
m_currentNode=elem;
}
catch ( java.lang.Exception de) {
throw new org.xml.sax.SAXException(de);
}
}
| Receive notification of the beginning of an element. <p> The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement() event for every startElement() event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement() event. </p> <p> If the element name has a namespace prefix, the prefix will still be attached. Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. </p> |
public Instant plusSeconds(long secondsToAdd){
return plus(secondsToAdd,0);
}
| Returns a copy of this instant with the specified duration in seconds added. <p> This instance is immutable and unaffected by this method call. |
@Provides public ResourceService resourceService(){
resourceServiceMock=mock(ResourceService.class);
return resourceServiceMock;
}
| Mock resource service |
private static void closeSecurityConfigurationFileInputStream(FileInputStream fis){
if (fis != null) {
try {
fis.close();
}
catch ( Exception ignoreMe) {
}
}
}
| Close the security.properties input stream once it's been used. Best effort |
public BasalInitializer(UpdateFunction updateFunction,double basalExpression,double initStDev){
if (updateFunction == null) {
throw new NullPointerException("Update function must not be " + "null");
}
if (initStDev <= 0) {
throw new IllegalArgumentException("The initialization standard " + "deviation must be positive");
}
this.updateFunction=updateFunction;
this.basalExpression=basalExpression;
this.initStDev=initStDev;
}
| Constructs a new history that will initialize genes using the given basal expression and initial standard deviation. |
public final ISchedulingRule derivedRule(IResource resource){
return null;
}
| Default implementation of <code>IResourceRuleFactory#derivedRule</code>. This default implementation always returns <code>null</code>. <p> Subclasses may not currently override this method. |
public EaseInOut(){
this(DEFAULT_AMPLITUDE,DEFAULT_PERIOD);
}
| Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. |
public Object[] toArray(){
return hlist.toArray();
}
| Array conversion. |
protected void removeTag(short tagId,int ifdId){
IfdData ifdData=mIfdDatas[ifdId];
if (ifdData == null) {
return;
}
ifdData.removeTag(tagId);
}
| Removes the tag with a given TID and IFD. |
public boolean isWellFormed(){
double totalProb=table.values().stream().mapToDouble(null).sum();
if (totalProb < 0.9f || totalProb > 1.1f) {
log.fine("total probability is " + totalProb);
return false;
}
return true;
}
| Returns true if the probability table is well-formed. The method checks that all possible assignments for the condition and head parts are covered in the table, and that the probabilities add up to 1.0f. |
protected final String rtp(String query){
return Util.rtp(query,tablePrefix,getSchedulerNameLiteral());
}
| <p> Replace the table prefix in a query by replacing any occurrences of "{0}" with the table prefix. </p> |
public boolean removeElement(int s){
if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE,null));
return super.removeElement(s);
}
| Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously. |
private void reconcilePositions(XtextResource resource){
MergingHighlightedPositionAcceptor acceptor=new MergingHighlightedPositionAcceptor(calculator);
acceptor.provideHighlightingFor(resource,this);
List<AttributedPosition> oldPositions=removedPositions;
List<AttributedPosition> newPositions=new ArrayList<AttributedPosition>(removedPositionCount);
for (int i=0, n=oldPositions.size(); i < n; i++) {
AttributedPosition current=oldPositions.get(i);
if (current != null) newPositions.add(current);
}
removedPositions=newPositions;
}
| Reconcile positions based on the AST subtrees |
public XingUser user(){
return user;
}
| Returns the bookmarked user. |
public static boolean checkMobileIsActive(Context context){
ConnectivityManager connec=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
android.net.NetworkInfo mobile=connec.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mobile.isConnected()) {
return true;
}
return false;
}
| Checks mobile network is active. |
public static int[] toIntArray(double[] array){
int[] result=new int[array.length];
for (int i=0; i < array.length; i++) {
result[i]=(int)array[i];
}
return result;
}
| Coverts given doubles array to array of ints. |
public void clearCache(){
clearMemoryCache();
clearDiskCache();
}
| Clears both the memory and disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread. |
public float[][] derivBasisFunctions(float u,int grade){
int span=findSpan(u);
return derivBasisFunctions(span,u,grade);
}
| Calculates the basis functions and its derivatives up to the given grade. |
public void postprocess(CompilationUnit unit,SymbolTable symbolTable){
}
| Postprocess... could be invoked multiple times. |
public Iterator<JsonElement> iterator(){
return elements.iterator();
}
| Returns an iterator to navigate the elements of the array. Since the array is an ordered list, the iterator navigates the elements in the order they were inserted. |
public InvalidPropertyException(){
super();
}
| Instantiates a new invalid property exception. |
public XmlDom child(String tag,String attr,String value){
List<XmlDom> c=children(tag,attr,value);
if (c.size() == 0) return null;
return c.get(0);
}
| Return the first child node that represent the matched tag that has attribute attr=value. A dummy node is returned if none found. |
private void updateCheckedItems(){
for ( TableItem item : tableViewer.getTable().getItems()) {
Object data=item.getData();
if (data instanceof AgentMapping) {
item.setChecked(((AgentMapping)data).isActive());
}
}
}
| Updates states of the check boxes next to the elements. |
public boolean isSandboxed(){
return base != null && uri != null && !base.relativize(uri).isAbsolute();
}
| Returns true if this script has a base URI and has a source URI that is contained within that base URI. |
private void adjustViewsUpOrDown(){
final int childCount=getChildCount();
int delta;
if (childCount > 0) {
View child;
if (!mStackFromBottom) {
child=getChildAt(0);
delta=child.getTop() - mListPadding.top;
if (mFirstPosition != 0) {
delta-=mDividerHeight;
}
if (delta < 0) {
delta=0;
}
}
else {
child=getChildAt(childCount - 1);
delta=child.getBottom() - (getHeight() - mListPadding.bottom);
if (mFirstPosition + childCount < mItemCount) {
delta+=mDividerHeight;
}
if (delta > 0) {
delta=0;
}
}
if (delta != 0) {
offsetChildrenTopAndBottom(-delta);
}
}
}
| Make sure views are touching the top or bottom edge, as appropriate for our gravity |
private Integer guessFormat(byte[] fileData){
Integer result=SyncParameter.EXPORT_FORMAT_VERINICE_ARCHIV;
if (fileData != null) {
String content=new String(fileData);
content=content.trim();
if (content.endsWith(SYNC_REQUEST)) {
result=SyncParameter.EXPORT_FORMAT_XML_PURE;
}
}
return result;
}
| Returns ExportCommand.EXPORT_FORMAT_XML_PURE if fileData is a verinice XML document if not ExportCommand.EXPORT_FORMAT_VERINICE_ARCHIV is returned. |
public boolean isExecutable(String sessionID,String path) throws DirectoryNotFoundException {
ResourceNode execNode=locate(sessionID,path);
if (execNode.getResource() == null) {
throw new DirectoryNotFoundException(String.format("Cannot execute '%s'",path));
}
if (execNode.getResource() instanceof Operation) {
return true;
}
return false;
}
| A primitive that indicates whether or not the resource associated with a node is executable. |
public boolean valueIsSmallerEqual(Instance instance,int dim,double value){
return instance.value(dim) <= value;
}
| Returns true if the value of the given dimension is smaller or equal the value to be compared with. |
public synchronized void add(int index,double x,double y){
while (mXY.get(x) != null) {
x+=getPadding(x);
}
mXY.put(index,x,y);
updateRange(x,y);
}
| Adds a new value to the series at the specified index. |
@Override public final Node loadTree(Body p,MathVector xpic,int l,Tree tree){
int si=oldSubindex(xpic,l);
Node rt=subp[si];
if (rt != null) subp[si]=rt.loadTree(p,xpic,l >> 1,tree);
else subp[si]=p;
return this;
}
| Descend Tree and insert particle. We're at a cell so we need to move down the tree. |
public Builder addContentItem(ContentItem contentItem){
if (contentItems == null) {
contentItems=new ArrayList<ContentItem>();
contentType=HttpMediaType.APPLICATION_JSON;
}
contentItems.add(contentItem);
return this;
}
| Adds a content items. |
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"SHSUB8");
translateAll(environment,instruction,"SHSUB8",instructions);
}
| SHSUB8{<cond>} <Rd>, <Rn>, <Rm> Operation: if ConditionPassed(cond) then diff = Rn[7:0] - Rm[7:0] // Signed subtraction Rd[7:0] = diff[8:1] diff = Rn[15:8] - Rm[15:8] // Signed subtraction Rd[15:8] = diff[8:1] diff = Rn[23:16] - Rm[23:16] // Signed subtraction Rd[23:16] = diff[8:1] diff = Rn[31:24] - Rm[31:24] // Signed subtraction Rd[31:24] = diff[8:1] |
int generateBridgeSecret(){
SecureRandom randGen=new SecureRandom();
expectedBridgeSecret=randGen.nextInt(Integer.MAX_VALUE);
return expectedBridgeSecret;
}
| Called by cordova.js to initialize the bridge. |
private void registerHeapVariables(IR ir){
SSADictionary dictionary=ir.HIRInfo.dictionary;
for (Enumeration<BasicBlock> bbe=ir.getBasicBlocks(); bbe.hasMoreElements(); ) {
BasicBlock b=bbe.nextElement();
for (Enumeration<Instruction> e=b.forwardInstrEnumerator(); e.hasMoreElements(); ) {
Instruction s=e.nextElement();
if (s.isImplicitLoad() || s.isImplicitStore() || s.isAllocation()|| Phi.conforms(s)|| s.isPEI()|| Label.conforms(s)|| BBend.conforms(s)|| s.getOpcode() == UNINT_BEGIN_opcode || s.getOpcode() == UNINT_END_opcode) {
dictionary.registerInstruction(s,b);
}
}
}
}
| Register every instruction in this method with the implicit heap array SSA lookaside structure. |
@Override public boolean evaluate(DF_LatticeCell[] operands){
ObjectCell lhs=(ObjectCell)operands[0];
if (lhs.isBOTTOM()) {
return false;
}
ObjectCell rhs=(ObjectCell)operands[1];
boolean lhsWasTOP=lhs.isTOP();
int[] oldNumbers=null;
if (!lhsWasTOP) oldNumbers=lhs.copyValueNumbers();
lhs.clear();
if (rhs.isTOP()) {
throw new OptimizingCompilerException("Unexpected lattice operation");
}
int[] numbers=rhs.copyValueNumbers();
if (numbers != null) {
for ( int number : numbers) {
if (valueNumbers.DD(number,valueNumber)) {
lhs.add(number);
}
}
}
lhs.add(valueNumber);
if (lhsWasTOP) return true;
int[] newNumbers=lhs.copyValueNumbers();
return ObjectCell.setsDiffer(oldNumbers,newNumbers);
}
| Evaluate the dataflow equation with this operator. |
Item newFloat(final float value){
key.set(value);
Item result=get(key);
if (result == null) {
pool.putByte(FLOAT).putInt(key.intVal);
result=new Item(index++,key);
put(result);
}
return result;
}
| Adds a float to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. |
public List<Budget> moveBudgetTree(final Budget b,final Position position){
final List<Budget> budgetsList=findAllBy("from Budget b where b.materializedPath like '" + b.getMaterializedPath() + ".%'");
return budgetsList;
}
| finds all the child budget tree for approval or rejection |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public int performBatchRecovery(Iterable<Translog.Operation> operations){
if (state != IndexShardState.RECOVERING) {
throw new IndexShardNotRecoveringException(shardId,state);
}
return engineConfig.getTranslogRecoveryPerformer().performBatchRecovery(engine(),operations);
}
| Applies all operations in the iterable to the current engine and returns the number of operations applied. This operation will stop applying operations once an operation failed to apply. Note: This method is typically used in peer recovery to replay remote transaction log entries. |
public static <K extends Comparable<K>,V extends Comparable<V>>Map<K,V> createByValueSortedMap(Map<K,V> map,boolean reversed,Comparator<V> comparator){
return new ByValueSortingTreeMap<>(ByValueComparator.create(map,reversed,comparator));
}
| Construct new sorted by values map using given map and comparator. |
private static Class<?> erase(Type type){
if (type instanceof Class) {
return (Class<?>)type;
}
else if (type instanceof ParameterizedType) {
return (Class<?>)((ParameterizedType)type).getRawType();
}
else if (type instanceof TypeVariable) {
TypeVariable<?> tv=(TypeVariable<?>)type;
if (tv.getBounds().length == 0) return Object.class;
else return erase(tv.getBounds()[0]);
}
else if (type instanceof GenericArrayType) {
GenericArrayType aType=(GenericArrayType)type;
return GenericArrayTypeImpl.createArrayType(erase(aType.getGenericComponentType()));
}
else if (type instanceof CaptureType) {
CaptureType captureType=(CaptureType)type;
if (captureType.getUpperBounds().length == 0) return Object.class;
else return erase(captureType.getUpperBounds()[0]);
}
else {
throw new RuntimeException("not supported: " + type.getClass());
}
}
| Returns the erasure of the given type. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:44.384 -0500",hash_original_method="8017C6E265731C6E1BE6E337AC0EFE2E",hash_generated_method="4B7330DFC58E357A5D1DD143C737CB5A") public SIPHeader parse() throws ParseException {
ServiceRouteList serviceRouteList=new ServiceRouteList();
if (debug) dbg_enter("ServiceRouteParser.parse");
try {
this.lexer.match(TokenTypes.SERVICE_ROUTE);
this.lexer.SPorHT();
this.lexer.match(':');
this.lexer.SPorHT();
while (true) {
ServiceRoute serviceRoute=new ServiceRoute();
super.parse(serviceRoute);
serviceRouteList.add(serviceRoute);
this.lexer.SPorHT();
if (lexer.lookAhead(0) == ',') {
this.lexer.match(',');
this.lexer.SPorHT();
}
else if (lexer.lookAhead(0) == '\n') break;
else throw createParseException("unexpected char");
}
return serviceRouteList;
}
finally {
if (debug) dbg_leave("ServiceRouteParser.parse");
}
}
| parse the String message and generate the RecordRoute List Object |
public static byte[] toByte(char[] c){
if (c == null) return null;
byte[] b=new byte[c.length * 2];
int i=0;
int j=0;
while (j < c.length) {
b[i++]=(byte)(c[j] & 0xFF);
b[i++]=(byte)((c[j++] >> 8) & 0xFF);
}
return b;
}
| Convert char array to byte array, where each char is split into two bytes. |
@Override public Object eInvoke(int operationID,EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case N4mfPackage.SIMPLE_PROJECT_DESCRIPTION___GET_VENDOR_ID:
return getVendorId();
}
return super.eInvoke(operationID,arguments);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Override public void run(){
String inputFile=args[0];
if (inputFile.toLowerCase().contains(".dep")) {
calculateRaster();
}
else if (inputFile.toLowerCase().contains(".shp")) {
calculateVector();
}
else {
showFeedback("There was a problem reading the input file.");
}
}
| Used to execute this plugin tool. |
public void testIsolatedMode() throws Exception {
processIsolatedModeTest(DeploymentMode.ISOLATED);
}
| Test GridDeploymentMode.ISOLATED mode. |
@Override public void eUnset(int featureID){
switch (featureID) {
case UmplePackage.INTERFACE_DEFINITION___NAME_1:
setName_1(NAME_1_EDEFAULT);
return;
case UmplePackage.INTERFACE_DEFINITION___DEPEND_1:
getDepend_1().clear();
return;
case UmplePackage.INTERFACE_DEFINITION___INTERFACE_BODY_1:
getInterfaceBody_1().clear();
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void visitInnerClass(String name,String outerName,String innerName,int access){
if (cv != null) {
cv.visitInnerClass(name,outerName,innerName,access);
}
}
| Visits information about an inner class. This inner class is not necessarily a member of the class being visited. |
public ModelMBeanOperationInfo(String name,String description,MBeanParameterInfo[] signature,String type,int impact,Descriptor descriptor){
super(name,description,signature,type,impact);
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,ModelMBeanOperationInfo.class.getName(),"ModelMBeanOperationInfo(String,String," + "MBeanParameterInfo[],String,int,Descriptor)","Entry");
}
operationDescriptor=validDescriptor(descriptor);
}
| Constructs a ModelMBeanOperationInfo object. |
private void emitSingleton(String opcode,boolean[][] testsPerformed,int level){
EmitterDescriptor ed=(EmitterDescriptor)emitters.iterator().next();
ArgumentType[] args=ed.getArgs();
int count=ed.getCount();
for (int i=0; i < count; i++) if (!testsPerformed[i][args[i].ordinal()]) emitVerify(i,args[i],level);
ArgumentType size=ed.getSize();
if (size != null) {
boolean needed=true;
for (int i=0; i < count; i++) if (testsPerformed[i][size.ordinal()]) needed=false;
if (needed) emitVerify(0,size,level);
if (size == ArgumentType.Byte) for (int i=0; i < count; i++) if (args[i] == ArgumentType.GPRegister) if (currentOpcode.indexOf("MOVZX") == -1 && currentOpcode.indexOf("MOVSX") == -1) {
emitTab(level);
emit("if (VM.VerifyAssertions) opt_assert(");
emitArgs(i,ArgumentType.GPRegister);
emit(".isValidAs8bitRegister());\n");
}
}
emitEmitCall(opcode,args,count,level,ed.getSize());
}
| Write the Java code required for error checking and calling the emit method represented by a singleton EmitterSet. A singleton EmiiterSet will typically be the result of a series of splits of bigger sets, where the splits represent emitted queries of operand types and sizes. (See emitSet) However, there may be cases when some operand has only one possible options, so the splitting will not have generated any tests for it. In this case, we will emit assertions that guarantee the operand is of the expected type. Note that the answers to queries alrrready performed by splitting are known to be fine, so no additional error checking is needed for cases they cover. |
public void scale(float sx,float sy){
showMissingWarning("scale");
}
| Scale in X and Y. Equivalent to scale(sx, sy, 1). Not recommended for use in 3D, because the z-dimension is just scaled by 1, since there's no way to know what else to scale it by. |
public Sequence findSequence(String sequenceName){
return sequences.get(sequenceName);
}
| Try to find a sequence with this name. This method returns null if no object with this name exists. |
public @Test final void testCreationNegative2(){
thrown.expect(IllegalArgumentException.class);
new Role("","TEST");
}
| Ensure that it is not allowed to create a Role without a name. |
public boolean checkConflictingPrimaryAnnos(final AnnotatedTypeMirror type,final Tree tree){
boolean error=false;
Set<AnnotationMirror> seenTops=AnnotationUtils.createAnnotationSet();
for ( AnnotationMirror aOnVar : type.getAnnotations()) {
if (AnnotationUtils.areSameByClass(aOnVar,PolyAll.class)) {
continue;
}
AnnotationMirror top=atypeFactory.getQualifierHierarchy().getTopAnnotation(aOnVar);
if (seenTops.contains(top)) {
this.reportError(type,tree);
error=true;
}
seenTops.add(top);
}
return error;
}
| Determines if there are multiple qualifiers from a single hierarchy in type's primary annotations. If so, report an error. |
public void paint(Graphics g){
super.paint(g);
if (drawIntersections || drawResults) {
OMGraphicList graphics;
graphics=new OMGraphicList(toDraw);
graphics.generate(getProjection(),true);
if (logger.isLoggable(Level.INFO)) {
logger.info("rendering toDraw " + toDraw.size() + " items");
}
graphics.render(g);
}
}
| If drawIntersections or drawResults is true, will add intersection markers or returned road lines to what is rendered. |
public boolean isValid(){
if (m_bpc == null) return false;
boolean ok=m_bpc.getAD_User_ID() != 0;
return ok;
}
| Return Valid. |
public CUDA_MEMCPY3D_PEER(){
}
| Creates a new, uninitialized CUDA_MEMCPY3D_PEER |
private void generateIndexMap(int size){
assert (size % 2 == 1);
int mapWidth=((size + 1) / 2) + 1;
mCenterCoefficient=(size - 1) / 2;
mCenterCoefficientMapIndex=mCenterCoefficient + 1;
mIndexMap=new int[size][mapWidth];
for (int x=0; x < mapWidth - 2; x+=2) {
mIndexMap[0][x]=x;
mIndexMap[0][x + 1]=size - 1 - x;
}
mIndexMap[0][mCenterCoefficientMapIndex]=mCenterCoefficient;
for (int x=1; x < size; x++) {
for (int y=0; y < mapWidth; y++) {
mIndexMap[x][y]=mIndexMap[x - 1][y] + 1;
if (mIndexMap[x][y] >= size) {
mIndexMap[x][y]-=size;
}
}
}
}
| Creates an n X (n + 1 / 2) index map enabling quick access to the circular buffer samples. As the buffer shifts right with each subsequent sample, we have to move the index pointers with it, for efficient access of the samples. The first array index value in the index map corresponds to the current buffer pointer location. The second array index value points to the samples that should be multiplied by the coefficients as follows: 0 = center tap sample, to be multiplied by center coefficient 0 = sample( 1 ) 1 = sample( size - 1 ) Indexes 0 and 1 will be multiplied by coefficient( 0 ). Subsequent indexes 3, 4, etc, point to the oldest and newest samples that correspond to the matching ( 3 ) coefficient index. |
private void connect(InetAddress anAddr,int aPort,int timeout) throws IOException {
InetAddress normalAddr=anAddr.isAnyLocalAddress() ? InetAddress.getLocalHost() : anAddr;
if (streaming && usingSocks()) {
socksConnect(anAddr,aPort,0);
}
else {
IoBridge.connect(fd,normalAddr,aPort,timeout);
}
super.address=normalAddr;
super.port=aPort;
}
| Connects this socket to the specified remote host address/port. |
public void unsetOperatorId(){
issetBitfield=EncodingUtils.clearBit(issetBitfield,OPERATORID_ISSET_ID);
}
| Description: <br> |
public static String toString(final URI uri) throws IOException {
return IOUtils.toString(uri,Charset.defaultCharset());
}
| Gets the contents at the given URI. |
public static byte[] decode(final byte[] source,final int off,final int len,final int options) throws java.io.IOException {
if (source == null) {
throw new NullPointerException("Cannot decode null source array.");
}
if (off < 0 || off + len > source.length) {
throw new IllegalArgumentException("Source array with length " + source.length + " cannot have offset of "+ off+ " and process "+ len+ " bytes.");
}
if (len == 0) {
return new byte[0];
}
else if (len < 4) {
throw new IllegalArgumentException("Base64-encoded string must have at least four characters, but length specified was " + len);
}
final byte[] DECODABET=getDecodabet(options);
final int len34=len * 3 / 4;
final byte[] outBuff=new byte[len34];
int outBuffPosn=0;
final byte[] b4=new byte[4];
int b4Posn=0;
int i=0;
byte sbiCrop=0;
byte sbiDecode=0;
for (i=off; i < off + len; i++) {
sbiCrop=(byte)(source[i] & 0x7f);
sbiDecode=DECODABET[sbiCrop];
if (sbiDecode >= WHITE_SPACE_ENC) {
if (sbiDecode >= EQUALS_SIGN_ENC) {
b4[b4Posn++]=sbiCrop;
if (b4Posn > 3) {
outBuffPosn+=decode4to3(b4,0,outBuff,outBuffPosn,options);
b4Posn=0;
if (sbiCrop == EQUALS_SIGN) {
break;
}
}
}
}
else {
throw new java.io.IOException("Bad Base64 input character '" + source[i] + "' in array position "+ i);
}
}
final byte[] out=new byte[outBuffPosn];
System.arraycopy(outBuff,0,out,0,outBuffPosn);
return out;
}
| Low-level access to decoding ASCII characters in the form of a byte array. <strong>Ignores GUNZIP option, if it's set.</strong> This is not generally a recommended method, although it is used internally as part of the decoding process. Special case: if len = 0, an empty array is returned. Still, if you need more speed and reduced memory footprint (and aren't gzipping), consider this method. |
public static void nl(String nl){
Formatting.nl=nl;
Formatting.dnl=nl + nl;
}
| Sets which new-line-character to use. Should be set before any code generation happens for indentation to work as expected. |
public T caseSymbolTableEntryIMOnly(SymbolTableEntryIMOnly object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Symbol Table Entry IM Only</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
@Override public ODataToken next(){
if (this.currentODataToken >= this.tokens.size()) {
throw new NoSuchElementException();
}
ODataToken ret=this.tokens.get(this.currentODataToken);
this.currentODataToken++;
return ret;
}
| Return the current token, advance ptr. |
public static boolean isLegal(boolean expression){
return isLegal(expression,"");
}
| Asserts that an argument is legal. If the given boolean is not <code>true</code>, an <code>IllegalArgumentException</code> is thrown. |
public Node<T> addChild(T data){
children.add(new Node<T>(data,depth + 1,this,children.size()));
return this;
}
| Adds a child node for the specified data. |
protected boolean isLast(){
if (myNode.getTreeNext() == null) {
return true;
}
IElementType elementType=myNode.getElementType();
if (elementType == END_DIRECTIVE) {
return true;
}
if (elementType != TT2_OPEN_TAG) {
return false;
}
ASTNode run=myNode.getTreeNext();
while (true) {
if (run == null) {
return false;
}
if (run.getElementType() == TT2_CLOSE_TAG) {
return run.getTreeNext() == null;
}
run=run.getTreeNext();
}
}
| Checks if current node is a last node or last block tag in the current parent |
public boolean putInt(Context context,String key,int value){
SharedPreferences settings=context.getSharedPreferences(FILE_NAME,Context.MODE_PRIVATE);
SharedPreferences.Editor editor=settings.edit();
editor.putInt(key,value);
return editor.commit();
}
| put int preferences |
public NetPermission(String name){
super(name);
}
| Creates a new NetPermission with the specified name. The name is the symbolic name of the NetPermission, such as "setDefaultAuthenticator", etc. An asterisk may appear at the end of the name, following a ".", or by itself, to signify a wildcard match. |
static final boolean validAnnotatedType(AnnotatedTypeMirror type){
if (type == null) {
return false;
}
if (type.getUnderlyingType() == null) {
return true;
}
return validType(type.getUnderlyingType());
}
| Assert that the type is a type of valid type mirror, i.e. not an ERROR or OTHER type. |
public void sendSynchronously(String commandName){
getClientDolphin().send(commandName);
syncPoint(1);
}
| for testing purposes, we may want to send commands synchronously such that we better know when to run asserts |
public final void invert(Matrix3d m1){
invertGeneral(m1);
}
| Sets the value of this matrix to the matrix inverse of the passed matrix m1. |
public void clone(float[] source){
System.arraycopy(source,0,points,0,3);
}
| Clone the input vector so that this vector has the same values. |
public static String asString(Object obj){
if (obj instanceof String) {
return (String)obj;
}
else if (obj instanceof RStringVector) {
return ((RStringVector)obj).getDataAt(0);
}
else {
return null;
}
}
| Checks and converts an object into a String. TODO rename as checkString |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
private void dumpEnvelope(Message m) throws Exception {
printOut("-----------------------------------------------------------------");
Address[] a;
if ((a=m.getFrom()) != null) {
for (int j=0; j < a.length; j++) printOut("FROM: " + a[j].toString());
}
if ((a=m.getRecipients(Message.RecipientType.TO)) != null) {
for (int j=0; j < a.length; j++) printOut("TO: " + a[j].toString());
}
printOut("SUBJECT: " + m.getSubject());
java.util.Date d=m.getSentDate();
printOut("SendDate: " + (d != null ? d.toString() : "UNKNOWN"));
Flags flags=m.getFlags();
StringBuffer sb=new StringBuffer();
Flags.Flag[] sf=flags.getSystemFlags();
boolean first=true;
for (int i=0; i < sf.length; i++) {
String s;
Flags.Flag f=sf[i];
if (f == Flags.Flag.ANSWERED) s="\\Answered";
else if (f == Flags.Flag.DELETED) s="\\Deleted";
else if (f == Flags.Flag.DRAFT) s="\\Draft";
else if (f == Flags.Flag.FLAGGED) s="\\Flagged";
else if (f == Flags.Flag.RECENT) s="\\Recent";
else if (f == Flags.Flag.SEEN) s="\\Seen";
else continue;
if (first) first=false;
else sb.append(' ');
sb.append(s);
}
String[] uf=flags.getUserFlags();
for (int i=0; i < uf.length; i++) {
if (first) first=false;
else sb.append(' ');
sb.append(uf[i]);
}
printOut("FLAGS: " + sb.toString());
String[] hdrs=m.getHeader("X-Mailer");
if (hdrs != null) {
StringBuffer sb1=new StringBuffer("X-Mailer: ");
for (int i=0; i < hdrs.length; i++) sb1.append(hdrs[i]).append(" ");
printOut(sb1.toString());
}
else printOut("X-Mailer NOT available");
hdrs=m.getHeader("Message-ID");
if (hdrs != null) {
StringBuffer sb1=new StringBuffer("Message-ID: ");
for (int i=0; i < hdrs.length; i++) sb1.append(hdrs[i]).append(" ");
printOut(sb1.toString());
}
else printOut("Message-ID NOT available");
printOut("ALL HEADERs:");
Enumeration en=m.getAllHeaders();
while (en.hasMoreElements()) {
Header hdr=(Header)en.nextElement();
printOut(" " + hdr.getName() + " = "+ hdr.getValue());
}
printOut("-----------------------------------------------------------------");
}
| Print Envelope |
public MoePlainView(Element elem){
super(elem);
}
| Constructs a BetterPlainView for the specified element. |
@Override public boolean equals(Object obj){
if (obj instanceof FileElement) {
return getPath().equals(((FileElement)obj).getPath());
}
return super.equals(obj);
}
| Compares the given object with this one and returns <code>true</code> iff the other object is also a <code>FileElement</code> and both objects share the same file path. |
protected void checkRow(int row){
if (row < 0 || row >= rows) throw new IndexOutOfBoundsException("Attempted to access " + toStringShort() + " at row="+ row);
}
| Sanity check for operations requiring a row index to be within bounds. |
protected Frame<V> newFrame(final int nLocals,final int nStack){
return new Frame<V>(nLocals,nStack);
}
| Constructs a new frame with the given size. |
public void queryContacts(){
mCommands[ContactsCommandType.QUERY_COMMAND.ordinal()].execute(null);
}
| Query the contacts. |
@Override public void process(KeyValPair<K,V> tuple){
HashMap<K,V> otuple=new HashMap<K,V>(1);
otuple.put(tuple.getKey(),tuple.getValue());
map.emit(otuple);
}
| Emits key, key/val pair, and val based on port connections |
protected void drawOrderedRenderable(DrawContext dc,PickSupport pickCandidates){
this.beginDrawing(dc);
try {
GL2 gl=dc.getGL().getGL2();
if (dc.isPickingMode()) {
Color pickColor=dc.getUniquePickColor();
pickCandidates.addPickableObject(pickColor.getRGB(),this,this.position);
gl.glColor3ub((byte)pickColor.getRed(),(byte)pickColor.getGreen(),(byte)pickColor.getBlue());
}
gl.glScaled(this.size,this.size,this.size);
this.drawUnitCube(dc);
}
finally {
this.endDrawing(dc);
}
}
| Set up drawing state, and draw the cube. This method is called when the cube is rendered in ordered rendering mode. |
public final boolean hasContended(){
return head != null;
}
| Queries whether any threads have ever contended to acquire this synchronizer; that is if an acquire method has ever blocked. <p>In this implementation, this operation returns in constant time. |
public static String encode(byte[] data){
StringBuilder builder=new StringBuilder();
for (int position=0; position < data.length; position+=3) {
builder.append(encodeGroup(data,position));
}
return builder.toString();
}
| Translates the specified byte array into Base64 string. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:20.421 -0500",hash_original_method="B481CD0C272F0294325516CB58C4D625",hash_generated_method="E62AEA9FA7B244F3FD7573DFDE704FA8") public boolean removeTransactionPendingAck(SIPServerTransaction serverTransaction){
String branchId=((SIPRequest)serverTransaction.getRequest()).getTopmostVia().getBranch();
if (branchId != null && this.terminatedServerTransactionsPendingAck.containsKey(branchId)) {
this.terminatedServerTransactionsPendingAck.remove(branchId);
return true;
}
else {
return false;
}
}
| Remove entry from "Transaction Pending ACK" table. |
private Colors(){
}
| This utility class cannot be instantiated |
private void drawHorizontalAxisTrace(Graphics2D g2,int x){
Rectangle2D dataArea=getScreenDataArea();
g2.setXORMode(Color.orange);
if (((int)dataArea.getMinX() < x) && (x < (int)dataArea.getMaxX())) {
if (this.verticalTraceLine != null) {
g2.draw(this.verticalTraceLine);
this.verticalTraceLine.setLine(x,(int)dataArea.getMinY(),x,(int)dataArea.getMaxY());
}
else {
this.verticalTraceLine=new Line2D.Float(x,(int)dataArea.getMinY(),x,(int)dataArea.getMaxY());
}
g2.draw(this.verticalTraceLine);
}
g2.setPaintMode();
}
| Draws a vertical line used to trace the mouse position to the horizontal axis. |
public void lostOwnership(Clipboard clipboard,Transferable contents){
}
| Required by the AbstractAction interface; does nothing. |
public boolean isExpanded(int row){
return getBoolean(row,VisualItem.EXPANDED);
}
| Indicates the given row is expanded. Only used for items that are part of a graph structure. |
public static Map<String,BLEUMetric<IString,String>.BLEUIncrementalMetric> run(List<List<Sequence<IString>>> referencesList,List<InputProperties> inputProperties,int order,List<String> lines) throws IOException {
Set<String> genreList=new HashSet<>();
Map<String,List<List<Sequence<IString>>>> refsByGenre=new HashMap<>();
for (int sourceId=0; sourceId < referencesList.size(); ++sourceId) {
String genre=inputProperties.get(sourceId).containsKey(InputProperty.Domain) ? ((String[])inputProperties.get(sourceId).get(InputProperty.Domain))[0] : DEFAULT_GENRE;
genreList.add(genre);
if (!refsByGenre.containsKey(genre)) {
refsByGenre.put(genre,new ArrayList<List<Sequence<IString>>>());
}
refsByGenre.get(genre).add(referencesList.get(sourceId));
}
Map<String,BLEUMetric<IString,String>.BLEUIncrementalMetric> metrics=new HashMap<>(genreList.size());
for ( String genre : genreList) {
BLEUMetric<IString,String> bleu=new BLEUMetric<IString,String>(refsByGenre.get(genre),order,false);
metrics.put(genre,bleu.getIncrementalMetric());
}
int sourceId=0;
for ( String line : lines) {
line=NISTTokenizer.tokenize(line);
Sequence<IString> translation=IStrings.tokenize(line);
ScoredFeaturizedTranslation<IString,String> tran=new ScoredFeaturizedTranslation<IString,String>(translation,null,0);
String genre=inputProperties.get(sourceId).containsKey(InputProperty.Domain) ? (String)inputProperties.get(sourceId).get(InputProperty.Domain) : DEFAULT_GENRE;
metrics.get(genre).add(tran);
++sourceId;
}
return metrics;
}
| Run the evaluator. |
private RealMatrix jacobian(RealVector point){
double[] pointArray=point.toArray();
double[][] jacobian=new double[distances.length][pointArray.length];
for (int i=0; i < jacobian.length; i++) {
for (int j=0; j < pointArray.length; j++) {
jacobian[i][j]=2 * pointArray[j] - 2 * positions[i][j];
}
}
return new Array2DRowRealMatrix(jacobian);
}
| Calculate and return Jacobian function Actually return initialized function Jacobian matrix, [i][j] at J[i][0] = delta_[(x0-xi)^2 + (y0-yi)^2 - ri^2]/delta_[x0] at J[i][1] = delta_[(x0-xi)^2 + (y0-yi)^2 - ri^2]/delta_[y0] partial derivative with respect to the parameters passed to value() method |
private static AnnotatedTypeMirror asOuterSuper(Types types,AnnotatedTypeFactory atypeFactory,AnnotatedTypeMirror type,AnnotatedTypeMirror superType){
if (type.getKind() == TypeKind.DECLARED) {
AnnotatedDeclaredType dt=(AnnotatedDeclaredType)type;
AnnotatedDeclaredType enclosingType=dt;
TypeMirror superTypeMirror=types.erasure(superType.getUnderlyingType());
while (enclosingType != null) {
TypeMirror enclosingTypeMirror=types.erasure(enclosingType.getUnderlyingType());
if (types.isSubtype(enclosingTypeMirror,superTypeMirror)) {
dt=enclosingType;
break;
}
enclosingType=enclosingType.getEnclosingType();
}
if (enclosingType == null) {
return superType;
}
return asSuper(atypeFactory,dt,superType);
}
return asSuper(atypeFactory,type,superType);
}
| Return the base type of type or any of its outer types that starts with the given type. If none exists, return null. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:42.092 -0500",hash_original_method="4476315D4E8DB7AB870F2DCC294654C2",hash_generated_method="51CA7377457AE130DE117AD44ED74083") public boolean hasError(){
return 1 == ((((hasSoftError())) ? 1 : 0) + (((hasHardError())) ? 1 : 0));
}
| A convenience method for determining of the SyncResult indicates that an error occurred. |
@Override public void show(ExportDataProvider dataProvider,String resourceName){
String extension=getFileExt(resourceName);
ExportFormat format=ExportFormat.getByExtension(extension);
show(dataProvider,resourceName,format);
}
| Show/Download resource at client side |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.