code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
@Override protected EClass eStaticClass(){
return N4JSPackage.Literals.BLOCK;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void include(String name,String encoding,boolean parse) throws IOException, TemplateException {
include(getTemplateForInclusion(name,encoding,parse));
}
| Emulates <code>include</code> directive, except that <code>name</code> must be tempate root relative. <p> It's the same as <code>include(getTemplateForInclusion(name, encoding, parse))</code>. But, you may want to separately call these two methods, so you can determine the source of exceptions more precisely, and thus achieve more intelligent error handling. |
public static Document createXMLValidationList(ValidationResults results,int initRow,Locale locale,String caseSensitive){
List fieldsInfo=createFieldsInfo(results);
Document doc=createDocument(initRow,results,results.getAdditionalFieldName(),"","",fieldsInfo,locale,caseSensitive,0,0);
Element root=doc.getRootElement();
Element nodeList=root.addElement(XML_NODELIST_TEXT);
Object[] scr=null;
Boolean bool=null;
for (Iterator it=results.getResults().iterator(); it.hasNext(); ) {
scr=(Object[])it.next();
addNode(0,(String)scr[1],(String)scr[0],"",Boolean.TRUE,"",Integer.MIN_VALUE,"",nodeList,"");
}
return doc;
}
| Public methods |
public T caseBindingElement(BindingElement object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Binding Element</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
private void printStepInstanceState(StepInstance stepInstance,boolean canBeSubmitted,boolean serialGroupCanRun,int unfinishedStepInstances){
if (!Utilities.verboseLog) {
return;
}
StepExecutionState state=stepInstance.getStepInstanceState();
if (stepInstance.getStepInstanceState() == StepExecutionState.STEP_EXECUTION_SUBMITTED) {
Utilities.verboseLog("Job: " + stepInstance.getStepId() + " id: "+ stepInstance.getId()+ " state: "+ state);
return;
}
if (verboseLogLevel >= 10 && unfinishedStepInstances < 50) {
String dependsOn="";
if (stepInstance.getStep(jobs).getId().contains("stepWriteOutput")) {
dependsOn="... all the stepInstances ...";
}
else {
List<StepInstance> dependeOnStepInstances=stepInstance.stepInstanceDependsUpon();
for ( StepInstance dependsOnSteInstance : dependeOnStepInstances) {
dependsOn+=getStepInstanceState(dependsOnSteInstance) + " ... ";
}
}
Utilities.verboseLog("-------------------------------\n" + "stepInstance considered: " + stepInstance.getId() + " Step Name: "+ stepInstance.getStep(jobs).getId()+ " canBeSubmitted : "+ canBeSubmitted+ " why? "+ " dependsOn: "+ dependsOn+ " Executions #: "+ stepInstance.getExecutions().size()+ " serialGroupCanRun: "+ serialGroupCanRun+ " serialgroup: "+ stepInstance.getStep(jobs).getSerialGroup()+ " stepInstance actual: "+ getStepInstanceState(stepInstance));
}
List<StepInstance> serialGroupStepInstances=stepInstanceDAO.getSerialGroupInstances(stepInstance,jobs);
int serialGroupStepInstancesSize=0;
if (serialGroupStepInstances != null) {
serialGroupStepInstancesSize=serialGroupStepInstances.size();
}
Utilities.verboseLog("Steps still running for the serial group: " + stepInstance.getStep(jobs).getSerialGroup() + " ("+ serialGroupStepInstancesSize+ ")");
if (serialGroupStepInstancesSize > 0) {
for ( StepInstance serialGroupStepInstance : serialGroupStepInstances) {
Utilities.verboseLog("Serial group check: " + serialGroupStepInstance.getStepId() + " - "+ serialGroupStepInstance.getId()+ " "+ serialGroupStepInstance.getExecutions());
}
}
Utilities.verboseLog(getDependencyInfo(stepInstance));
}
| print stepInstance info |
public String dbName(){
return dbName;
}
| Get the name of the database in which the collection exists. |
private static boolean copyFile(Path oldFilename,Path newFilename){
if (!oldFilename.toAbsolutePath().toString().equals(newFilename.toAbsolutePath().toString())) {
LOGGER.info("copy file " + oldFilename + " to "+ newFilename);
if (oldFilename.equals(newFilename)) {
return moveFile(oldFilename,newFilename);
}
try {
if (!Files.exists(newFilename.getParent())) {
Files.createDirectory(newFilename.getParent());
}
Utils.copyFileSafe(oldFilename,newFilename,true);
return true;
}
catch ( Exception e) {
return false;
}
}
else {
return true;
}
}
| copies file. |
public void callArgVisitors(XPathVisitor visitor){
for (int i=0; i < m_argVec.size(); i++) {
Expression exp=(Expression)m_argVec.elementAt(i);
exp.callVisitors(new ArgExtOwner(exp),visitor);
}
}
| Call the visitors for the function arguments. |
public void notifyInvalidated(){
synchronized (mObservers) {
for ( DataSetObserverExtended observer : mObservers) {
observer.onInvalidated();
}
}
}
| Invokes onInvalidated on each observer. Called when the data set being monitored has changed such that it is no longer valid. |
public ServerContext validateServerConnection(final ServerContext context){
Validator validator=new Validator(context);
return validateServerConnection(context,validator);
}
| Validates a provided server context and if validation succeeds saves a server context with the user's team foundation Id |
public static <I,A>Parser<I,A> choice(Parser<I,? extends A> p1,Parser<I,? extends A> p2,Parser<I,? extends A> p3,Parser<I,? extends A> p4,Parser<I,? extends A> p5){
return or(p1,or(p2,or(p3,or(p4,p5))));
}
| choice tries to apply the parsers in the list <code>ps</code> in order, until one of them succeeds. It returns the value of the succeeding parser |
@Override public void configureZone(final StendhalRPZone zone,final Map<String,String> attributes){
buildForger(zone);
}
| Configure a zone. |
public IntHashMap(int initialCapacity,float loadFactor){
super();
if (initialCapacity < 0) {
throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
}
if (loadFactor <= 0) {
throw new IllegalArgumentException("Illegal Load: " + loadFactor);
}
if (initialCapacity == 0) {
initialCapacity=1;
}
this.loadFactor=loadFactor;
table=new Entry[initialCapacity];
threshold=(int)(initialCapacity * loadFactor);
}
| <p>Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.</p> |
public String toString(){
return image;
}
| Returns the image. |
void startForegroundCompat(int id,Notification notification){
if (mStartForeground != null) {
mStartForegroundArgs[0]=Integer.valueOf(id);
mStartForegroundArgs[1]=notification;
invokeMethod(mStartForeground,mStartForegroundArgs);
return;
}
mSetForegroundArgs[0]=Boolean.TRUE;
invokeMethod(mSetForeground,mSetForegroundArgs);
mNM.notify(id,notification);
}
| This is a wrapper around the new startForeground method, using the older APIs if it is not available. |
public MultiPolygon createMultiPolygon(Polygon[] polygons){
return new MultiPolygon(polygons,this);
}
| Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon. The polygons must conform to the assertions specified in the <A HREF="http://www.opengis.org/techno/specs.htm">OpenGIS Simple Features Specification for SQL</A>. |
@NoInline @Entrypoint static void raiseIllegalAccessError(){
throw new java.lang.IllegalAccessError();
}
| Create and throw a java.lang.IllegalAccessError. Used to handle error cases in invokeinterface dispatching. |
public void lookupLoadComplete(){
if (m_lookup == null) return;
m_lookup.loadComplete();
}
| Wait until Load is complete |
public TLongObjectHashMap(int initialCapacity){
super(initialCapacity);
_hashingStrategy=this;
}
| Creates a new <code>TLongObjectHashMap</code> instance with a prime capacity equal to or greater than <tt>initialCapacity</tt> and with the default load factor. |
public FaceletException(Throwable cause){
super(cause);
}
| <p class="changed_added_2_0">Wrap argument <code>cause</code> within this <code>FaceletException</code> instance.</p> |
protected <T extends SpatialComparable>void peanoSort(List<T> objs,int start,int end,double[] mms,int[] dims,int depth,long[] bits,boolean desc){
final int numdim=(dims != null) ? dims.length : (mms.length >> 1);
final int edim=(dims != null) ? dims[depth] : depth;
final double min=mms[2 * edim], max=mms[2 * edim + 1];
final double tfirst=(min + min + max) / 3.;
final double tsecond=(min + max + max) / 3.;
if (max - tsecond < 1E-10 || tsecond - tfirst < 1E-10 || tfirst - min < 1E-10) {
boolean ok=false;
for (int d=0; d < numdim; d++) {
int d2=((dims != null) ? dims[d] : d) << 1;
if (mms[d2 + 1] - mms[d2] >= 1E-10) {
ok=true;
break;
}
}
if (!ok) {
return;
}
}
final boolean inv=BitsUtil.get(bits,edim) ^ desc;
int fsplit, ssplit;
if (!inv) {
fsplit=pivotizeList1D(objs,start,end,edim,tfirst,false);
ssplit=(fsplit < end - 1) ? pivotizeList1D(objs,fsplit,end,edim,tsecond,false) : fsplit;
}
else {
fsplit=pivotizeList1D(objs,start,end,edim,tsecond,true);
ssplit=(fsplit < end - 1) ? pivotizeList1D(objs,fsplit,end,edim,tfirst,true) : fsplit;
}
int nextdim=(depth + 1) % numdim;
if (start < fsplit - 1) {
mms[2 * edim]=!inv ? min : tsecond;
mms[2 * edim + 1]=!inv ? tfirst : max;
peanoSort(objs,start,fsplit,mms,dims,nextdim,bits,desc);
}
if (fsplit < ssplit - 1) {
BitsUtil.flipI(bits,edim);
mms[2 * edim]=tfirst;
mms[2 * edim + 1]=tsecond;
peanoSort(objs,fsplit,ssplit,mms,dims,nextdim,bits,!desc);
BitsUtil.flipI(bits,edim);
}
if (ssplit < end - 1) {
mms[2 * edim]=!inv ? tsecond : min;
mms[2 * edim + 1]=!inv ? max : tfirst;
peanoSort(objs,ssplit,end,mms,dims,nextdim,bits,desc);
}
mms[2 * edim]=min;
mms[2 * edim + 1]=max;
}
| Sort by Peano curve. |
private static byte[] readClass(final InputStream is,boolean close) throws IOException {
if (is == null) {
throw new IOException("Class not found");
}
try {
byte[] b=new byte[is.available()];
int len=0;
while (true) {
int n=is.read(b,len,b.length - len);
if (n == -1) {
if (len < b.length) {
byte[] c=new byte[len];
System.arraycopy(b,0,c,0,len);
b=c;
}
return b;
}
len+=n;
if (len == b.length) {
int last=is.read();
if (last < 0) {
return b;
}
byte[] c=new byte[b.length + 1000];
System.arraycopy(b,0,c,0,len);
c[len++]=(byte)last;
b=c;
}
}
}
finally {
if (close) {
is.close();
}
}
}
| Reads the bytecode of a class. |
public Source<Double> fromNegativeInfinityToNegativeZero(){
return Compositions.weightWithValues(Doubles.fromNegativeInfinityToNegativeZero(),Double.NEGATIVE_INFINITY,-0d);
}
| Generates Doubles inclusively bounded below by Double.NEGATIVE_INFINITY and above by a value very close to zero on the negative side. The Source is weighted so it is likely to generate the upper and lower limits of the domain one or more times. |
public void removeNode(Node n){
if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE,null));
this.removeElement(n);
}
| Remove a node. |
private static void verifyCodewordCount(int[] codewords,int numECCodewords) throws FormatException {
if (codewords.length < 4) {
throw FormatException.getFormatInstance();
}
int numberOfCodewords=codewords[0];
if (numberOfCodewords > codewords.length) {
throw FormatException.getFormatInstance();
}
if (numberOfCodewords == 0) {
if (numECCodewords < codewords.length) {
codewords[0]=codewords.length - numECCodewords;
}
else {
throw FormatException.getFormatInstance();
}
}
}
| Verify that all is OK with the codeword array. |
public void test_getBitsFromByteArray_06(){
final byte[] b=new byte[2];
BytesUtil.setBit(b,11,true);
BytesUtil.setBit(b,12,true);
BytesUtil.setBit(b,13,true);
BytesUtil.setBit(b,14,true);
assertEquals(0x00000000,getBits(b,0,11));
assertEquals(0x00000001,getBits(b,0,12));
assertEquals(0x00000003,getBits(b,0,13));
assertEquals(0x00000007,getBits(b,0,14));
assertEquals(0x0000000f,getBits(b,0,15));
assertEquals(0x0000001e,getBits(b,0,16));
try {
getBits(b,0,17);
fail("Expecting: " + IllegalArgumentException.class);
}
catch ( IllegalArgumentException ex) {
if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex);
}
assertEquals(0x0000001e,getBits(b,1,15));
assertEquals(0x0000001e,getBits(b,2,14));
assertEquals(0x0000001e,getBits(b,3,13));
assertEquals(0x0000001e,getBits(b,4,12));
assertEquals(0x0000001e,getBits(b,5,11));
assertEquals(0x0000001e,getBits(b,6,10));
assertEquals(0x0000001e,getBits(b,7,9));
assertEquals(0x0000001e,getBits(b,8,8));
assertEquals(0x0000001e,getBits(b,9,7));
assertEquals(0x0000001e,getBits(b,10,6));
assertEquals(0x0000001e,getBits(b,11,5));
assertEquals(0x0000000e,getBits(b,12,4));
assertEquals(0x00000006,getBits(b,13,3));
assertEquals(0x00000002,getBits(b,14,2));
assertEquals(0x00000000,getBits(b,15,1));
try {
getBits(b,16,1);
fail("Expecting: " + IllegalArgumentException.class);
}
catch ( IllegalArgumentException ex) {
if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex);
}
}
| byte[2] (16-bits) |
public static void exitWithFailure(){
exitWithFailure(1);
}
| Exit, giving a visible failure message |
private void rebuildNode(){
m_realizer.regenerate();
m_graph.updateViews();
}
| Regenerates the content of the node and updates the graph view. |
public void readLbMaps(BufferedReader fin) throws IOException {
if (lbStr2Int != null) {
lbStr2Int.clear();
}
else {
lbStr2Int=new HashMap();
}
if (lbInt2Str != null) {
lbInt2Str.clear();
}
else {
lbInt2Str=new HashMap();
}
String line;
if ((line=fin.readLine()) == null) {
System.out.println("No label map size information");
return;
}
int numLabels=Integer.parseInt(line);
if (numLabels <= 0) {
System.out.println("Invalid label map size");
return;
}
System.out.println("Reading label maps ...");
for (int i=0; i < numLabels; i++) {
line=fin.readLine();
if (line == null) {
System.out.println("Invalid label map line");
return;
}
StringTokenizer strTok=new StringTokenizer(line," \t\r\n");
if (strTok.countTokens() != 2) {
continue;
}
String lbStr=strTok.nextToken();
String lbInt=strTok.nextToken();
lbStr2Int.put(lbStr,new Integer(lbInt));
lbInt2Str.put(new Integer(lbInt),lbStr);
}
System.out.println("Reading label maps (" + Integer.toString(lbStr2Int.size()) + " entries) completed!");
line=fin.readLine();
}
| Read lb maps. |
public static void main(String[] args){
String deviceCfg=args[0];
DirectProvider tp=new DirectProvider();
DirectTopology topology=tp.newTopology("IotpSensors");
IotDevice device=new IotpDevice(topology,new File(deviceCfg));
simulatedSensors(device,true);
heartBeat(device,true);
displayMessages(device,true);
tp.submit(topology);
}
| Run the IotpSensors application. Takes a single argument that is the path to the device configuration file containing the connection authentication information. |
@Override public void initialize(Map<String,Object> properties){
if (properties.containsKey("traversal-limit")) {
TRAVERSAL_LIMIT=Integer.parseInt((String)properties.get("traversal-limit"));
log("Init property:",Level.FINE,"traversal-limit",TRAVERSAL_LIMIT);
}
}
| Initialize any configurable settings from the properties. |
public void mouseReleased(MouseEvent e){
}
| If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle clean up settings from mousePressed |
@Override public void eUnset(int featureID){
switch (featureID) {
case N4JSPackage.TYPE_DEFINING_ELEMENT__DEFINED_TYPE:
setDefinedType((Type)null);
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void adjustSizeForAbsolute(boolean isHor){
int[] curSizes=isHor ? width : height;
Cell absCell=grid.get(null);
if (absCell == null || absCell.compWraps.size() == 0) {
return;
}
ArrayList<CompWrap> cws=absCell.compWraps;
int maxEnd=0;
for (int j=0, cwSz=absCell.compWraps.size(); j < cwSz + 3; j++) {
boolean doAgain=false;
for (int i=0; i < cwSz; i++) {
CompWrap cw=cws.get(i);
int[] stSz=getAbsoluteDimBounds(cw,0,isHor);
int end=stSz[0] + stSz[1];
if (maxEnd < end) {
maxEnd=end;
}
if (linkTargetIDs != null) {
doAgain|=setLinkedBounds(cw.comp,cw.cc,stSz[0],stSz[0],stSz[1],stSz[1],false);
}
}
if (doAgain == false) {
break;
}
maxEnd=0;
clearGroupLinkBounds();
}
maxEnd+=LayoutUtil.getInsets(lc,isHor ? 3 : 2,!hasDocks()).getPixels(0,container,null);
if (curSizes[LayoutUtil.MIN] < maxEnd) {
curSizes[LayoutUtil.MIN]=maxEnd;
}
if (curSizes[LayoutUtil.PREF] < maxEnd) {
curSizes[LayoutUtil.PREF]=maxEnd;
}
}
| Adjust grid's width or height for the absolute components' positions. |
public ServiceCompatibilityException(Reason reason){
super(reason.toString());
setMessageKey(getMessageKey() + "." + reason.toString());
bean.setReason(reason);
}
| Constructs a new exception with the specified reason set as its detail message and appended to the message key. |
public boolean hasData(final long address,final int length){
Preconditions.checkArgument(address >= 0,"Error: Address can't be less than 0");
Preconditions.checkArgument(length > 0,"Error: Length must be positive");
try {
m_readLock.lock();
MemoryChunk nextChunk=findChunk(address);
int nextLength=length;
long nextAddress=address;
do {
if (nextChunk == null) {
return false;
}
else if (((nextChunk.getAddress() + nextChunk.getLength()) - nextAddress) >= nextLength) {
return true;
}
else {
nextLength-=(nextChunk.getAddress() + nextChunk.getLength()) - nextAddress;
nextAddress=nextChunk.getAddress() + nextChunk.getLength();
nextChunk=findChunk(nextAddress);
}
}
while (true);
}
finally {
m_readLock.unlock();
}
}
| Determines whether the memory has length bytes starting from the given address. |
private synchronized void closeAllConnections(){
for ( MySQLConnection c : this.liveConnections.values()) {
try {
c.close();
}
catch ( SQLException e) {
}
}
if (!this.isClosed) {
this.balancer.destroy();
if (this.connectionGroup != null) {
this.connectionGroup.closeConnectionProxy(this);
}
}
this.liveConnections.clear();
this.connectionsToHostsMap.clear();
}
| Closes all live connections. |
@Override public Object clone() throws CloneNotSupportedException {
return super.clone();
}
| Returns a clone of the renderer. |
public static void importTypes(final CConnection connection,final int rawModuleId,final int moduleId) throws SQLException {
final String query="INSERT INTO " + CTableNames.TYPE_MEMBERS_TABLE + " SELECT "+ moduleId+ ", id, name, base_type, parent_id, position, argument, number_of_elements"+ " FROM "+ String.format(CTableNames.RAW_TYPES,rawModuleId);
connection.executeUpdate(query,true);
final String updateSequence=String.format("SELECT setval('bn_types_id_seq', " + "COALESCE((SELECT MAX(id) + 1 FROM %s), 1), false) from %s",CTableNames.TYPE_MEMBERS_TABLE,CTableNames.TYPE_MEMBERS_TABLE);
connection.executeQuery(updateSequence,true);
}
| Imports the type members. |
public void populateAnnotatedStrings(){
for ( Example example : this.examples) {
example.populateAnnotatedStrings();
}
}
| Populate examples with the temporary list of matched and unmatched strings (using current match and unmatch bounds) |
protected void registerKnownJdkImmutableClasses(){
registerImmutable(String.class);
registerImmutable(Integer.class);
registerImmutable(Long.class);
registerImmutable(Boolean.class);
registerImmutable(Class.class);
registerImmutable(Float.class);
registerImmutable(Double.class);
registerImmutable(Character.class);
registerImmutable(Byte.class);
registerImmutable(Short.class);
registerImmutable(Void.class);
registerImmutable(BigDecimal.class);
registerImmutable(BigInteger.class);
registerImmutable(URI.class);
registerImmutable(URL.class);
registerImmutable(UUID.class);
registerImmutable(Pattern.class);
}
| registers some known JDK immutable classes. Override this to register your own list of jdk's immutable classes |
public Date(long date){
fastTime=date;
}
| Allocates a <code>Date</code> object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. |
public static boolean canVisualize(Relation<?> rel,AbstractMTree<?,?,?,?> tree){
if (!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
return false;
}
return getLPNormP(tree) > 0;
}
| Test for a visualizable index in the context's database. |
public void putStopTime(Integer stopSequencePosition,StopTime stopTime){
stopTimes.put(stopSequencePosition,stopTime);
}
| Puts a new stopTime |
public LinkedList<Patch> patch_make(String text1,String text2){
if (text1 == null || text2 == null) {
throw new IllegalArgumentException("Null inputs. (patch_make)");
}
LinkedList<Diff> diffs=diff_main(text1,text2,true);
if (diffs.size() > 2) {
diff_cleanupSemantic(diffs);
diff_cleanupEfficiency(diffs);
}
return patch_make(text1,diffs);
}
| Compute a list of patches to turn text1 into text2. A set of diffs will be computed. |
protected void volumeChange(ChangeEvent e){
JSlider v=(JSlider)e.getSource();
log.debug("Volume slider moved. value = " + v.getValue());
firePropertyChange(PropertyChangeID.VOLUME_CHANGE,v.getValue(),v.getValue());
}
| Handle volume slider change |
protected Instance mergeInstances(Instance source,Instance dest){
Instances outputFormat=outputFormatPeek();
double[] vals=new double[outputFormat.numAttributes()];
for (int i=0; i < vals.length; i++) {
if ((i != outputFormat.classIndex()) && (m_SelectedCols.isInRange(i))) {
if ((source != null) && !source.isMissing(i) && !dest.isMissing(i)) {
vals[i]=dest.value(i) - source.value(i);
}
else {
vals[i]=Utils.missingValue();
}
}
else {
vals[i]=dest.value(i);
}
}
Instance inst=null;
if (dest instanceof SparseInstance) {
inst=new SparseInstance(dest.weight(),vals);
}
else {
inst=new DenseInstance(dest.weight(),vals);
}
inst.setDataset(dest.dataset());
return inst;
}
| Creates a new instance the same as one instance (the "destination") but with some attribute values copied from another instance (the "source") |
public boolean sameReturnType(MemberDefinition method){
if (!isMethod() || !method.isMethod()) {
throw new CompilerError("sameReturnType: not method");
}
Type myReturnType=getType().getReturnType();
Type yourReturnType=method.getType().getReturnType();
return (myReturnType == yourReturnType);
}
| Convenience method to see if two methods return the same type |
protected void sequence_AnnotatedExportableElement_ClassExtendsClause_ClassImplementsList_Members_N4ClassDeclaration_TypeVariables(ISerializationContext context,N4ClassDeclaration semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: ExportableElement returns N4ClassDeclaration Constraint: ( ( ( annotationList=AnnotatedExportableElement_N4ClassDeclaration_1_2_0_0_0 declaredModifiers+=N4Modifier* typingStrategy=TypingStrategyDefSiteOperator? name=BindingIdentifier ) | (declaredModifiers+=N4Modifier* typingStrategy=TypingStrategyDefSiteOperator? name=BindingIdentifier?) ) (typeVars+=TypeVariable typeVars+=TypeVariable*)? ( ( superClassRef=ParameterizedTypeRefNominal? (implementedInterfaceRefs+=ParameterizedTypeRefNominal implementedInterfaceRefs+=ParameterizedTypeRefNominal*)? ) | superClassExpression=LeftHandSideExpression )? ownedMembersRaw+=N4MemberDeclaration ) |
public UncheckedExecutionException(@Nullable Throwable cause){
super(cause);
}
| Creates a new instance with the given cause. |
public DefaultRetryPolicy(int initialTimeoutMs,int maxNumRetries,float backoffMultiplier){
mCurrentTimeoutMs=initialTimeoutMs;
mMaxNumRetries=maxNumRetries;
mBackoffMultiplier=backoffMultiplier;
}
| Constructs a new retry policy. |
public ExtendedKeyUsageExtension(Vector<ObjectIdentifier> keyUsages) throws IOException {
this(Boolean.FALSE,keyUsages);
}
| Create a ExtendedKeyUsageExtension object from a Vector of Key Usages; the criticality is set to false. |
public void testBadDynamicUpdate() throws Exception {
pm.loadProperties();
try {
TungstenProperties dynaProps=new TungstenProperties();
dynaProps.setString(ReplicatorConf.APPLIER,"bad value!");
pm.setDynamicProperties(dynaProps);
fail("Able to update non-dynamic property: " + ReplicatorConf.APPLIER);
}
catch ( ReplicatorException e) {
}
try {
TungstenProperties dynaProps=new TungstenProperties();
dynaProps.setString("foo","non-existent property");
pm.setDynamicProperties(dynaProps);
fail("Able to update non-dynamic property: foo");
}
catch ( ReplicatorException e) {
}
}
| Prove that updating a non-dynamic property or one that does not exist generates an exception. |
public OSXApplication(){
}
| Creates a new instance. |
public INode contains(INode n){
for (int i=0; i < stack.size(); i++) {
if (stack.elementAt(i).equals(n)) {
return stack.elementAt(i);
}
}
return null;
}
| A costly operation in a stack; typically not required. |
public static double cuCimag(cuDoubleComplex x){
return x.y;
}
| Returns the imaginary part of the given complex number. |
public static LongStream dropWhile(LongStream stream,LongPredicate predicate){
Objects.requireNonNull(stream);
Objects.requireNonNull(predicate);
return StreamSupport.longStream(new WhileOps.UnorderedWhileSpliterator.OfLong.Dropping(stream.spliterator(),true,predicate),stream.isParallel()).onClose(null);
}
| Returns a stream consisting of the remaining elements of the passed stream after discarding elements that match the given predicate up to, but not discarding, the first element encountered that does not match the predicate. All subsequently encountered elements are not discarded. <p>This is a <a href="package-summary.html#StreamOps">stateful intermediate operation</a>. |
private static void removeLiveReference(Object value){
synchronized (sLiveObjects) {
Integer count=sLiveObjects.get(value);
if (count == null) {
FLog.wtf("SharedReference","No entry in sLiveObjects for value of type %s",value.getClass());
}
else if (count == 1) {
sLiveObjects.remove(value);
}
else {
sLiveObjects.put(value,count - 1);
}
}
}
| Decreases the reference count of live object from the static map. Removes it if it's reference count has become 0. |
private void onMouseDown(){
panel.setStyleName(toolbarResources.toolbar().popupButtonPanelDown());
}
| Mouse Down handler. |
private static String makeDateName(final Date date){
final long millis=date.getTime();
final long mask=(long)1E4;
final int lodate=(int)(millis % mask);
final int hidate=(int)(millis / mask);
final String newname=Integer.toHexString(lodate) + Integer.toHexString(hidate);
return newname;
}
| Make date name. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-03-25 14:54:55.686 -0400",hash_original_method="9641FF451616EC3082A54513AAA1A1A4",hash_generated_method="CF9ED3CF8BF1BA7AC9C1394B6CB12D83") public DrmInfo(int infoType,byte[] data,String mimeType){
mInfoType=infoType;
mMimeType=mimeType;
mData=data;
}
| Creates a <code>DrmInfo</code> object with the given parameters. |
public AttributeServiceImpl(final GenericDAO<Attribute,Long> attributeDao,final AttributeGroupService attributeGroupService){
super(attributeDao);
this.attributeDao=attributeDao;
this.attributeGroupService=attributeGroupService;
}
| Construct attribute service |
public void testBug33734() throws Exception {
Connection testConn=getConnectionWithProps("cachePrepStmts=true,useServerPrepStmts=false");
try {
testConn.prepareStatement("SELECT 1");
}
finally {
testConn.close();
}
}
| Tests fix for BUG#33734 - NullPointerException when using client-side prepared statements and enabling caching of prepared statements (only present in nightly builds of 5.1). |
public void startExecutionEveryDayAt(CustomTimerTask task,int targetHour,int targetMin,int targetSec){
BotLogger.warn(LOGTAG,"Posting new task" + task.getTaskName());
final Runnable taskWrapper=null;
if (task.getTimes() != 0) {
final long delay=computNextDilay(targetHour,targetMin,targetSec);
executorService.schedule(taskWrapper,delay,TimeUnit.SECONDS);
}
}
| Add a new CustomTimerTask to be executed |
public synchronized void clear(){
if (mMap.isEmpty()) return;
for ( Pair<Integer,Subscription> pair : mMap.values()) {
if (!pair.second.isUnsubscribed()) pair.second.unsubscribe();
}
}
| Clear all the subscriptions |
public void drag(long time,float x,float y,float amountX,float amountY){
float scrollDrag, discardDrag;
if (mCurrentMode == Orientation.PORTRAIT) {
discardDrag=amountX;
scrollDrag=amountY;
}
else {
discardDrag=amountY;
scrollDrag=LocalizationUtils.isLayoutRtl() ? -amountX : amountX;
}
DragLock hintLock=computeDragLock(scrollDrag,discardDrag);
if (hintLock == DragLock.DISCARD) {
discard(x,y,amountX,amountY);
}
else {
if (mDragLock == DragLock.SCROLL && mDiscardingTab != null) {
commitDiscard(time,false);
}
scroll(x,y,LocalizationUtils.isLayoutRtl() ? -amountX : amountX,amountY,false);
}
requestUpdate();
}
| Called on drag event (from scroll events in the gesture detector). |
protected int compare(Object a,Object b,boolean ascending){
String s1;
String s2;
if (a instanceof String) {
s1=(String)a;
s2=(String)b;
}
else {
s1=(String)((Map)a).get("name");
s2=(String)((Map)b).get("name");
}
s1=s1.toUpperCase();
s2=s2.toUpperCase();
if (ascending) {
return s1.compareTo(s2);
}
else {
return -s1.compareTo(s2);
}
}
| This method can be overriden by subclasses to allow sorting arbitrary objects within the list, it follows the traditional contract of the compare method in Java |
protected void firePropertyChange(String propertyName,Object oldValue,Object newValue){
if (changeSupport != null) {
changeSupport.firePropertyChange(propertyName,oldValue,newValue);
}
}
| Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners. |
public Filter createFilter(BridgeContext ctx,Element filterElement,Element filteredElement,GraphicsNode filteredNode,Filter inputFilter,Rectangle2D filterRegion,Map filterMap){
Filter in=getIn(filterElement,filteredElement,filteredNode,inputFilter,filterMap,ctx);
if (in == null) {
return null;
}
Rectangle2D defaultRegion=in.getBounds2D();
Rectangle2D primitiveRegion=SVGUtilities.convertFilterPrimitiveRegion(filterElement,filteredElement,filteredNode,defaultRegion,filterRegion,ctx);
float dx=convertNumber(filterElement,SVG_DX_ATTRIBUTE,0,ctx);
float dy=convertNumber(filterElement,SVG_DY_ATTRIBUTE,0,ctx);
AffineTransform at=AffineTransform.getTranslateInstance(dx,dy);
PadRable pad=new PadRable8Bit(in,primitiveRegion,PadMode.ZERO_PAD);
Filter filter=new AffineRable8Bit(pad,at);
filter=new PadRable8Bit(filter,primitiveRegion,PadMode.ZERO_PAD);
handleColorInterpolationFilters(filter,filterElement);
updateFilterMap(filterElement,filter,filterMap);
return filter;
}
| Creates a <tt>Filter</tt> primitive according to the specified parameters. |
public boolean isCharacterElementContentWhitespace(int nodeHandle){
return false;
}
| 2. [element content whitespace] A boolean indicating whether the character is white space appearing within element content (see [XML], 2.10 "White Space Handling"). Note that validating XML processors are required by XML 1.0 to provide this information. If there is no declaration for the containing element, this property has no value for white space characters. If no declaration has been read, but the [all declarations processed] property of the document information item is false (so there may be an unread declaration), then the value of this property is unknown for white space characters. It is always false for characters that are not white space. |
public SVGMaskElementBridge(){
}
| Constructs a new bridge for the <mask> element. |
public void send(String message){
try {
writer.write(message + "\n");
writer.flush();
}
catch ( IOException e) {
throw new RuntimeException("Error writing " + message,e);
}
}
| Send a message to the process over the standard input. |
public Permutation(int n){
if (n <= 0) {
throw new IllegalArgumentException("invalid length");
}
perm=new int[n];
for (int i=n - 1; i >= 0; i--) {
perm[i]=i;
}
}
| Create the identity permutation of the given size. |
public boolean registerRequest(HGPeerIdentity peerId,Timestamp last_version,Timestamp current_version){
Peer peer=getPeer(peerId);
if (peer.getLastFrom().compareTo(last_version) != 0 && false) {
try {
System.out.println("Log: expecting " + last_version + " and found "+ peer.getLastFrom()+ ". Waiting...");
getPeerQueue(peerId,true).put(last_version,current_version);
synchronized (current_version) {
current_version.wait();
}
}
catch ( InterruptedException e) {
e.printStackTrace();
}
return true;
}
return true;
}
| serializes messages from each peer. initializes catchup phase if necessary. |
private Iterator iterator(){
List list=list();
if (list != null) {
return (list.iterator());
}
else {
return (null);
}
}
| <p>Return an <code>Iterator</code> over the customer list, if any; otherwise return <code>null</code>.</p> |
public URI(final String s,final boolean escaped) throws URIException, NullPointerException {
parseUriReference(s,escaped);
}
| Construct a URI from a string with the given charset. The input string can be either in escaped or unescaped form. |
public UnscheduleTimeEvent createUnscheduleTimeEvent(){
UnscheduleTimeEventImpl unscheduleTimeEvent=new UnscheduleTimeEventImpl();
return unscheduleTimeEvent;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static long calculateDays(Date mDate1,Date mDate2){
return Math.abs((mDate1.getTime() - mDate2.getTime()) / (24 * 60 * 60* 1000) + 1);
}
| calculate difference form two dates Note: both dates are in same format. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:05.457 -0500",hash_original_method="5D7214C35F0B8EFCD4776395D10A0F27",hash_generated_method="29ACC9DE2D8A4C1B8CFCE6AA59A2D59D") public PasswordAuthentication(String userName,char[] password){
this.userName=userName;
this.password=password.clone();
}
| Creates an instance of a password authentication with a specified username and password. |
@Override public <R,A>CompletableFuture<R> collect(final Collector<? super T,A,R> collector){
return CompletableFuture.supplyAsync(null);
}
| Asynchronously perform a Stream collection |
protected static final List<CView> processQueryResults(final ResultSet resultSet,final INaviProject project,final Map<Integer,Set<CTag>> tags,final ITagManager nodeTagManager,final SQLProvider provider,final List<CView> views,final ViewType viewType,final GraphType graphType) throws SQLException {
final Map<Integer,Set<CTag>> nodeTagMap=getNodeTags(provider.getConnection(),project,nodeTagManager);
try {
while (resultSet.next()) {
final int viewId=resultSet.getInt("view_id");
final String name=PostgreSQLHelpers.readString(resultSet,"name");
final String description=PostgreSQLHelpers.readString(resultSet,"description");
final Timestamp creationDate=resultSet.getTimestamp("creation_date");
final Timestamp modificationDate=resultSet.getTimestamp("modification_date");
final boolean starState=resultSet.getBoolean("stared");
final int nodeCount=resultSet.getInt("bbcount");
final int edgeCount=resultSet.getInt("edgecount");
final Set<CTag> viewTags=tags.containsKey(viewId) ? tags.get(viewId) : new HashSet<CTag>();
final Set<CTag> nodeTags=nodeTagMap.containsKey(viewId) ? nodeTagMap.get(viewId) : new HashSet<CTag>();
final CProjectViewGenerator generator=new CProjectViewGenerator(provider,project);
views.add(generator.generate(viewId,name,description,viewType,graphType,creationDate,modificationDate,nodeCount,edgeCount,viewTags,nodeTags,starState));
}
return views;
}
finally {
resultSet.close();
}
}
| Processes the results of a view loading query. |
@Override public void close(){
close(null);
}
| Close all indexers. |
@Override public void expandToInclude(final Envelope other){
if (other.isNull()) {
return;
}
final double otherMinZ=getMinZOf(other);
final double otherMaxZ=getMaxZOf(other);
if (isNull()) {
super.expandToInclude(other);
minz=otherMinZ;
maxz=otherMaxZ;
}
else {
super.expandToInclude(other);
if (otherMinZ < minz) {
minz=otherMinZ;
}
if (otherMaxZ > maxz) {
maxz=otherMaxZ;
}
}
}
| Enlarges this <code>Envelope</code> so that it contains the <code>other</code> Envelope. Has no effect if <code>other</code> is wholly on or within the envelope. |
@Deprecated public AssumptionViolatedException(String assumption){
this(assumption,false,null,null);
}
| An assumption exception with the given message only. |
public void formListDownloadingComplete(HashMap<String,FormDetails> result){
dismissDialog(PROGRESS_DIALOG);
mDownloadFormListTask.setDownloaderListener(null);
mDownloadFormListTask=null;
if (result == null) {
Log.e(t,"Formlist Downloading returned null. That shouldn't happen");
createAlertDialog(getString(R.string.load_remote_form_error),getString(R.string.error_occured),EXIT);
return;
}
if (result.containsKey(DownloadFormListTask.DL_AUTH_REQUIRED)) {
showDialog(AUTH_DIALOG);
}
else if (result.containsKey(DownloadFormListTask.DL_ERROR_MSG)) {
String dialogMessage=getString(R.string.list_failed_with_error,result.get(DownloadFormListTask.DL_ERROR_MSG).errorStr);
String dialogTitle=getString(R.string.load_remote_form_error);
createAlertDialog(dialogTitle,dialogMessage,DO_NOT_EXIT);
}
else {
mFormNamesAndURLs=result;
mFormList.clear();
ArrayList<String> ids=new ArrayList<String>(mFormNamesAndURLs.keySet());
for (int i=0; i < result.size(); i++) {
String formDetailsKey=ids.get(i);
FormDetails details=mFormNamesAndURLs.get(formDetailsKey);
HashMap<String,String> item=new HashMap<String,String>();
item.put(FORMNAME,details.formName);
item.put(FORMID_DISPLAY,((details.formVersion == null) ? "" : (getString(R.string.version) + " " + details.formVersion+ " ")) + "ID: " + details.formID);
item.put(FORMDETAIL_KEY,formDetailsKey);
item.put(FORM_ID_KEY,details.formID);
item.put(FORM_VERSION_KEY,details.formVersion);
if (mFormList.size() == 0) {
mFormList.add(item);
}
else {
int j;
for (j=0; j < mFormList.size(); j++) {
HashMap<String,String> compareMe=mFormList.get(j);
String name=compareMe.get(FORMNAME);
if (name.compareTo(mFormNamesAndURLs.get(ids.get(i)).formName) > 0) {
break;
}
}
mFormList.add(j,item);
}
}
selectSupersededForms();
mFormListAdapter.notifyDataSetChanged();
mDownloadButton.setEnabled(!(selectedItemCount() == 0));
}
}
| Called when the form list has finished downloading. results will either contain a set of <formname, formdetails> tuples, or one tuple of DL.ERROR.MSG and the associated message. |
public static String atomMarshall(Object entityDto) throws ODataException, UnsupportedEncodingException {
return atomMarshall(entityDto,getDefaultTestUri());
}
| Returns an Atom XML file which contains a entry node containing an OData marshalled form of the entity (DTO) object. |
void debugCode(String java){
if (isEnabled(TraceSystem.DEBUG)) {
traceWriter.write(TraceSystem.DEBUG,module,lineSeparator + "/**/" + java,null);
}
}
| Write Java source code with trace level DEBUG to the trace system. |
public void update(byte[] in,int off,int len){
while (len > 0 && messageLength < mBuf.length) {
this.update(in[off]);
off++;
len--;
}
digest.update(in,off,len);
messageLength+=len;
}
| update the internal digest with the byte array in |
private String createNonCGSrdfPairStepsOnEmptyGroup(List<VolumeDescriptor> sourceDescriptors,List<VolumeDescriptor> targetDescriptors,RemoteDirectorGroup group,Map<URI,Volume> uriVolumeMap,String waitFor,Workflow workflow){
StorageSystem system=dbClient.queryObject(StorageSystem.class,group.getSourceStorageSystemUri());
URI vpoolChangeUri=getVirtualPoolChangeVolume(sourceDescriptors);
log.info("VPoolChange URI {}",vpoolChangeUri);
List<URI> sourceURIs=VolumeDescriptor.getVolumeURIs(sourceDescriptors);
List<URI> targetURIs=new ArrayList<>();
for ( URI sourceURI : sourceURIs) {
Volume source=uriVolumeMap.get(sourceURI);
StringSet srdfTargets=source.getSrdfTargets();
for ( String targetStr : srdfTargets) {
URI targetURI=URI.create(targetStr);
targetURIs.add(targetURI);
}
}
Method createListMethod=createListReplicasMethod(system.getId(),sourceURIs,targetURIs,vpoolChangeUri,true);
Method rollbackMethod=rollbackSRDFLinksMethod(system.getId(),sourceURIs,targetURIs,false);
String stepId=workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP,CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_DESC,waitFor,system.getId(),system.getSystemType(),getClass(),createListMethod,rollbackMethod,null);
return stepId;
}
| This method creates steps to create SRDF pairs in an empty SRDF group. |
public SurfaceObjectTileStateKey(DrawContext dc,SurfaceObjectTile tile){
if (tile != null && tile.hasObjects()) {
this.tileKey=tile.getTileKey();
this.intersectingObjectKeys=new Object[tile.getObjectList().size()];
int index=0;
for ( SurfaceRenderable so : tile.getObjectList()) {
this.intersectingObjectKeys[index++]=so.getStateKey(dc);
}
}
else {
this.tileKey=null;
this.intersectingObjectKeys=null;
}
}
| Construsts a tile state key for the specified surface renderable tile. |
public static String restoreBSSID(String BSSID){
StringBuilder sb=new StringBuilder();
for (int index=0; index < BSSID.length(); index+=2) {
sb.append(BSSID.substring(index,index + 2));
if (index != BSSID.length() - 2) {
sb.append(":");
}
}
return sb.toString().toLowerCase(Locale.US);
}
| restore the bssid from esptouch result |
public boolean equals(TextLayout rhs){
if (rhs == null) {
return false;
}
if (rhs == this) {
return true;
}
ensureCache();
return textLine.equals(rhs.textLine);
}
| Returns <code>true</code> if the two layouts are equal. Two layouts are equal if they contain equal glyphvectors in the same order. |
public UserDeletionConstraintException(String message){
super(message);
}
| Constructs a new exception with the specified detail message. The cause is not initialized. |
@Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case GamlPackage.IF__IF_FALSE:
setIfFalse((Expression)newValue);
return;
}
super.eSet(featureID,newValue);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
protected String rebuildUserQuery(List<Clause> clauses,boolean lowercaseOperators){
StringBuilder sb=new StringBuilder();
for (int i=0; i < clauses.size(); i++) {
Clause clause=clauses.get(i);
String s=clause.raw;
if (lowercaseOperators && i > 0 && i + 1 < clauses.size()) {
if ("AND".equalsIgnoreCase(s)) {
s="AND";
}
else if ("OR".equalsIgnoreCase(s)) {
s="OR";
}
}
sb.append(s);
sb.append(' ');
}
return sb.toString();
}
| Generates a query string from the raw clauses, uppercasing 'and' and 'or' as needed. |
private VNXeException(final ServiceCode code,final Throwable cause,final String detailBase,final String detailKey,final Object[] detailParams){
super(false,code,cause,detailBase,detailKey,detailParams);
}
| Holds the methods used to create VNXe related error conditions |
public static void main(String[] args) throws SolrServerException, IOException {
service=new RetrieveAndRank();
service.setUsernameAndPassword(USERNAME,PASSWORD);
solrClient=getSolrClient(service.getSolrUrl(SOLR_CLUSTER_ID),USERNAME,PASSWORD);
try {
uploadConfiguration();
createCollection();
indexDocumentAndCommit();
searchAllDocs();
}
catch ( final Exception e) {
e.printStackTrace();
}
finally {
cleanupResources();
}
}
| The main method. |
public boolean hasPlayers(){
return !gameData.getPlayers().isEmpty();
}
| Returns true if the game has any players, false otherwise. |
public int rangeToInt(int bitOffset,int numOfBits){
int result=0;
int baseShift=numOfBits - 8 + bitOffset % 8;
int byteIdx=bitOffset / 8;
while (baseShift >= 0) {
result|=vector[byteIdx] << baseShift;
byteIdx++;
baseShift-=8;
}
if (baseShift < 0) result|=vector[byteIdx] >>> Math.abs(baseShift);
result&=0xFFFFFFFF >>> 32 - numOfBits;
return result;
}
| reads an arbitrary (even non-aligned) range of bits (up to 32) and interprets them as int (bigendian) |
public void testIndexWriterSettings() throws Exception {
String algLines[]={"# ----- properties ","content.source=org.apache.lucene.benchmark.byTask.feeds.LineDocSource","docs.file=" + getReuters20LinesFile(),"content.source.log.step=3","ram.flush.mb=-1","max.buffered=2","compound=cmpnd:true:false","doc.term.vector=vector:false:true","content.source.forever=false","directory=RAMDirectory","doc.stored=false","merge.factor=3","doc.tokenized=false","debug.level=1","# ----- alg ","{ \"Rounds\""," ResetSystemErase"," CreateIndex"," { \"AddDocs\" AddDoc > : * "," NewRound","} : 2"};
Benchmark benchmark=execBenchmark(algLines);
final IndexWriter writer=benchmark.getRunData().getIndexWriter();
assertEquals(2,writer.getConfig().getMaxBufferedDocs());
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH,(int)writer.getConfig().getRAMBufferSizeMB());
assertEquals(3,((LogMergePolicy)writer.getConfig().getMergePolicy()).getMergeFactor());
assertEquals(0.0d,writer.getConfig().getMergePolicy().getNoCFSRatio(),0.0);
writer.close();
Directory dir=benchmark.getRunData().getDirectory();
IndexReader reader=DirectoryReader.open(dir);
Fields tfv=reader.getTermVectors(0);
assertNotNull(tfv);
assertTrue(tfv.size() > 0);
reader.close();
}
| Test that IndexWriter settings stick. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.