code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static void registerMetadata(MetadataRegistry registry){
if (registry.isRegistered(KEY)) {
return;
}
ElementCreator builder=registry.build(KEY).setContentRequired(false);
builder.addAttribute(CONTENT_TYPE);
builder.addAttribute(ERROR_COUNT).setRequired(true);
builder.addAttribute(TOTAL_COUNT).setRequired(true);
builder.addAttribute(REASON);
builder.addAttribute(SUCCESS_COUNT).setRequired(true);
builder.addAttribute(SKIPPED_COUNT).setRequired(true);
}
| Registers the metadata for this element. |
public String signature(int i){
return descriptor(i);
}
| This method is equivalent to <code>descriptor()</code>. If this attribute represents a LocalVariableTypeTable attribute, this method should be used instead of <code>descriptor()</code> since the method name is more appropriate. <p>To parse the string, call <code>toFieldSignature(String)</code> in <code>SignatureAttribute</code>. |
public <V2>JavaPairRDD<Tuple2<K,V>,Option<V2>> outerJoinGeodeRegion(String regionPath,GeodeConnectionConf connConf){
GeodeOuterJoinRDD<Tuple2<K,V>,K,V2> rdd=rddf.outerJoinGeodeRegion(regionPath,connConf);
ClassTag<Tuple2<K,V>> kt=fakeClassTag();
ClassTag<Option<V2>> vt=fakeClassTag();
return new JavaPairRDD<>(rdd,kt,vt);
}
| Perform a left outer join of this RDD<K, V> and the Geode `Region<K, V2>`. For each element (k, v) in this RDD, the resulting RDD will either contain all pairs ((k, v), Some(v2)) for v2 in the Geode region, or the pair ((k, v), None)) if no element in the Geode region have key k. |
public static String serialize(Element element){
StringWriter sw=new StringWriter();
serialize(new DOMSource(element),sw);
return sw.toString();
}
| Return a pretty String version of the Element. |
public boolean typeNameSet(){
return ((this.getTypeName() != null) && (!this.getTypeName().isEmpty()));
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void searchDeclarationsOfReferencedTypes(IJavaElement enclosingElement,SearchRequestor requestor,IProgressMonitor monitor) throws JavaModelException {
if (VERBOSE) {
Util.verbose("BasicSearchEngine.searchDeclarationsOfReferencedTypes(IJavaElement, SearchRequestor, SearchPattern, IProgressMonitor)");
}
switch (enclosingElement.getElementType()) {
case IJavaElement.FIELD:
case IJavaElement.METHOD:
case IJavaElement.TYPE:
case IJavaElement.COMPILATION_UNIT:
break;
default :
throw new IllegalArgumentException();
}
SearchPattern pattern=new DeclarationOfReferencedTypesPattern(enclosingElement);
searchDeclarations(enclosingElement,requestor,pattern,monitor);
}
| Searches for all declarations of the types referenced in the given element. The element can be a compilation unit or a source type/method/field. Reports the type declarations using the given requestor. |
public void toggle(boolean animate){
toggle(animate,fadeIn,fadeOut);
}
| Toggle the badge visibility in the UI. |
public int add(E o,int row){
T dl=getNewDataLine(o);
return dl == null ? -1 : add(dl,row);
}
| Helper function. Uses getNewDataLine(Object) and add(DataLine, int). Extending classes can override this, but it is recommended that they override the two above methods instead. |
public void testKeyword() throws Exception {
Input keys[]=new Input[]{new Input("foo",50),new Input("bar",10),new Input("barbar",12),new Input("barbara",6)};
Analyzer analyzer=new MockAnalyzer(random(),MockTokenizer.KEYWORD,false);
Directory tempDir=getDirectory();
FuzzySuggester suggester=new FuzzySuggester(tempDir,"fuzzy",analyzer);
suggester.build(new InputArrayIterator(keys));
List<LookupResult> results=suggester.lookup(TestUtil.stringToCharSequence("bariar",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("barbr",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("barbara",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbara",results.get(0).key.toString());
assertEquals(6,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("barbar",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
assertEquals("barbara",results.get(1).key.toString());
assertEquals(6,results.get(1).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("barbaa",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
assertEquals("barbara",results.get(1).key.toString());
assertEquals(6,results.get(1).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("f",random()),false,2);
assertEquals(1,results.size());
assertEquals("foo",results.get(0).key.toString());
assertEquals(50,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("bar",random()),false,1);
assertEquals(1,results.size());
assertEquals("bar",results.get(0).key.toString());
assertEquals(10,results.get(0).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("b",random()),false,2);
assertEquals(2,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
assertEquals("bar",results.get(1).key.toString());
assertEquals(10,results.get(1).value,0.01F);
results=suggester.lookup(TestUtil.stringToCharSequence("ba",random()),false,3);
assertEquals(3,results.size());
assertEquals("barbar",results.get(0).key.toString());
assertEquals(12,results.get(0).value,0.01F);
assertEquals("bar",results.get(1).key.toString());
assertEquals(10,results.get(1).value,0.01F);
assertEquals("barbara",results.get(2).key.toString());
assertEquals(6,results.get(2).value,0.01F);
IOUtils.close(analyzer,tempDir);
}
| this is basically the WFST test ported to KeywordAnalyzer. so it acts the same |
public URI(String scheme,String schemeSpecificPart,String fragment) throws URISyntaxException {
StringBuilder uri=new StringBuilder();
if (scheme != null) {
uri.append(scheme);
uri.append(':');
}
if (schemeSpecificPart != null) {
ALL_LEGAL_ENCODER.appendEncoded(uri,schemeSpecificPart);
}
if (fragment != null) {
uri.append('#');
ALL_LEGAL_ENCODER.appendEncoded(uri,fragment);
}
parseURI(uri.toString(),false);
}
| Creates a new URI instance of the given unencoded component parts. |
protected int nextInTopLevel() throws IOException, XMLException {
switch (current) {
case 0x9:
case 0xA:
case 0xD:
case 0x20:
do {
nextChar();
}
while (current != -1 && XMLUtilities.isXMLSpace((char)current));
return LexicalUnits.S;
case '<':
switch (nextChar()) {
case '?':
context=PI_CONTEXT;
return readPIStart();
case '!':
switch (nextChar()) {
case '-':
return readComment();
case 'D':
context=DOCTYPE_CONTEXT;
return readIdentifier("OCTYPE",LexicalUnits.DOCTYPE_START,-1);
default :
throw createXMLException("invalid.character");
}
default :
context=START_TAG_CONTEXT;
depth++;
return readName(LexicalUnits.START_TAG);
}
case -1:
return LexicalUnits.EOF;
default :
throw createXMLException("invalid.character");
}
}
| Advances to the next lexical unit in the top level context. |
public KMLTimeStamp(String namespaceURI){
super(namespaceURI);
}
| Construct an instance. |
public JSONStringer endArray() throws JSONException {
return close(Scope.EMPTY_ARRAY,Scope.NONEMPTY_ARRAY,"]");
}
| Ends encoding the current array. |
public final void testGetKeysize(){
RSAKeyGenParameterSpec rkgps=new RSAKeyGenParameterSpec(512,BigInteger.valueOf(0L));
assertEquals(512,rkgps.getKeysize());
}
| Test for <code>getKeySize()</code> method<br> Assertion: returns key size value |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:56:23.272 -0500",hash_original_method="82CCBEF7CE2F6615EFEE4A91C0BA2F9C",hash_generated_method="422C6824B767C066DE9BAE5D3104F2DE") @Deprecated public static boolean isJavaLetterOrDigit(char c){
return isJavaIdentifierPart(c);
}
| Indicates whether the specified character is a Java letter or digit character. |
public void ruimo(Code code){
switch (code) {
case A:
System.out.println("Hello");
break;
case B:
System.out.println("Hello");
break;
default :
break;
}
}
| patch 1524949 (submitted as a patch, not a bug) |
public void testInt() throws IOException {
Directory dir=newDirectory();
RandomIndexWriter writer=new RandomIndexWriter(random(),dir);
Document doc=new Document();
doc.add(new NumericDocValuesField("value",300000));
doc.add(newStringField("value","300000",Field.Store.YES));
writer.addDocument(doc);
doc=new Document();
doc.add(new NumericDocValuesField("value",-1));
doc.add(newStringField("value","-1",Field.Store.YES));
writer.addDocument(doc);
doc=new Document();
doc.add(new NumericDocValuesField("value",4));
doc.add(newStringField("value","4",Field.Store.YES));
writer.addDocument(doc);
IndexReader ir=writer.getReader();
writer.close();
IndexSearcher searcher=newSearcher(ir);
Sort sort=new Sort(new SortField("value",SortField.Type.INT));
TopDocs td=searcher.search(new MatchAllDocsQuery(),10,sort);
assertEquals(3,td.totalHits);
assertEquals("-1",searcher.doc(td.scoreDocs[0].doc).get("value"));
assertEquals("4",searcher.doc(td.scoreDocs[1].doc).get("value"));
assertEquals("300000",searcher.doc(td.scoreDocs[2].doc).get("value"));
ir.close();
dir.close();
}
| Tests sorting on type int |
public static String joinGt(boolean phased,int... gt){
final char sep=phased ? PHASED_SEPARATOR : UNPHASED_SEPARATOR;
switch (gt.length) {
case 0:
return MISSING_FIELD;
case 1:
return encodeId(gt[0]);
case 2:
return encodeId(gt[0]) + sep + encodeId(gt[1]);
default :
final StringBuilder sb=new StringBuilder();
for (final int c : gt) {
if (sb.length() > 0) {
sb.append(sep);
}
sb.append(encodeId(c));
}
return sb.toString();
}
}
| Utility method for creating a VCF genotype subfield from an array of numeric allele identifiers. |
public static Marshaller createMarshaller(Class<?> clazz,NamespacePrefixMapper mpr) throws Exception {
Marshaller marshaller=createMarshaller(clazz);
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper",mpr);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT,Boolean.TRUE);
return marshaller;
}
| Creates a marshaller for the given class and namespace prefix mapper. |
public static CatalogEntry createCatalogEntry(Product product,Marketplace marketplace){
CatalogEntry catalogEntry=new CatalogEntry();
catalogEntry.setProduct(product);
catalogEntry.setMarketplace(marketplace);
return catalogEntry;
}
| Creates a <code>CatalogEntry</code> for given supplier and product on the given marketplace and sets the position of the entry to the end of existing products of this organization. The created catalog entry is not yet persisted. If no marketplace is given, the local marketplace of the supplier is assumed. |
public VertxTodoServiceVerticle(ManagedServiceBuilder managedServiceBuilder){
this.managedServiceBuilder=managedServiceBuilder;
}
| Create this verticle |
public static Test suite(){
return (new TestSuite(Issue1757ITCase.class));
}
| Return the tests included in this test suite. |
public boolean optBoolean(String key,boolean defaultValue){
try {
return this.getBoolean(key);
}
catch ( Exception e) {
return defaultValue;
}
}
| Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is not a Boolean or the String "true" or "false" (case insensitive). |
public CustomerInfo(String id){
this.id=id;
this.searchkey=null;
this.taxid=null;
this.name=null;
this.postal=null;
this.phone=null;
this.email=null;
}
| Creates a new instance of UserInfoBasic |
protected JButton createPopupButton(){
return new BuddyButton();
}
| Creates and returns the popup button. Override to use a custom popup button. |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:22.389 -0500",hash_original_method="C0676E9FE520D18F322700EE730819D6",hash_generated_method="29D24BE5410E4955A051AB5D177667AC") public CancellationException(){
}
| Constructs a <tt>CancellationException</tt> with no detail message. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public Builder withSslProtocol(SslProtocol sslProtocol){
properties.setProperty(NettyOptions.SSL_PROTOCOL,Assert.notNull(sslProtocol,"sslProtocol").name().replace("_","."));
return this;
}
| Sets the SSL protocol. |
@Override public void add(int index,Instance instance){
Instance newInstance=(Instance)instance.copy();
newInstance.setDataset(this);
m_Instances.add(index,newInstance);
}
| Adds one instance at the given position in the list. Shallow copies instance before it is added. Increases the size of the dataset if it is not large enough. Does not check if the instance is compatible with the dataset. Note: String or relational values are not transferred. |
public AdeDirectoriesManagerImpl(String outputPath) throws AdeException {
this(outputPath,null,null);
}
| Construct the manager given the root directory. |
public boolean equals(Object obj){
return obj instanceof Date && getTime() == ((Date)obj).getTime();
}
| Compares two dates for equality. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>Date</code> object that represents the same point in time, to the millisecond, as this object. <p> Thus, two <code>Date</code> objects are equal if and only if the <code>getTime</code> method returns the same <code>long</code> value for both. |
protected void onListChanged(){
if (swipeListViewListener != null) {
swipeListViewListener.onListChanged();
}
}
| Notifies onListChanged |
public VolumeListImpl(){
init(ISicresAdminDefsKeys.NULL_ID);
}
| Construye un objeto de la clase por defecto. |
public void notifyMTU(int mtu){
m_mtu_advise=mtu;
if (m_state == PseudoTcpState.TCP_ESTABLISHED) {
adjustMTU();
}
}
| Set the MTU (maximum transmission unit) value |
CipherSuiteList(String[] names){
if (names == null) {
throw new IllegalArgumentException("CipherSuites may not be null");
}
cipherSuites=new ArrayList<CipherSuite>(names.length);
for (int i=0; i < names.length; i++) {
String suiteName=names[i];
CipherSuite suite=CipherSuite.valueOf(suiteName);
if (suite.isAvailable() == false) {
throw new IllegalArgumentException("Cannot support " + suiteName + " with currently installed providers");
}
cipherSuites.add(suite);
}
}
| Construct a CipherSuiteList from a array of names. We don't bother to eliminate duplicates. |
@Override public StorageOSUserDAO resolveUser(BaseToken token){
if (token == null) {
return null;
}
URI userId=null;
boolean isProxy=token instanceof ProxyToken;
if (isProxy) {
userId=((ProxyToken)token).peekLastKnownId();
}
else {
userId=((Token)token).getUserId();
}
StorageOSUserDAO userDAO=_dbClient.queryObject(StorageOSUserDAO.class,userId);
if (userDAO == null) {
_log.error("No user record found or userId: {}",userId.toString());
return null;
}
return userDAO;
}
| Gets a userDAO record from a token or proxytoken |
public boolean isHighPriorityStep(Step step){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" Step Id : " + step.getId());
}
if (step.getId().toLowerCase().contains("stepLoadFromFasta".toLowerCase()) || step.getId().toLowerCase().contains("panther".toLowerCase()) || step.getId().toLowerCase().contains("prositeprofiles".toLowerCase())) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" panther/prositeprofiles job: " + step.getId() + " Should have high priority");
}
return true;
}
return false;
}
| * check if the job is hamap or prosite then assign it higher priority |
public Main(String name,PrintWriter out){
this.ownName=name;
this.out=out;
}
| Construct a compiler instance. |
public boolean isSetKey(){
return this.key != null;
}
| Returns true if field key is set (has been assigned a value) and false otherwise |
public void skip(){
signature=signature.substring(1);
}
| Skip the first character of the remaining part of the signature. |
public Order incorporate(OrderEvent orderEvent){
if (orderStatus == null) orderStatus=OrderStatus.PURCHASED;
switch (orderStatus) {
case PURCHASED:
if (orderEvent.getType() == OrderEventType.CREATED) orderStatus=OrderStatus.PENDING;
break;
case PENDING:
if (orderEvent.getType() == OrderEventType.ORDERED) {
orderStatus=OrderStatus.CONFIRMED;
}
else if (orderEvent.getType() == OrderEventType.PURCHASED) {
orderStatus=OrderStatus.PURCHASED;
}
break;
case CONFIRMED:
if (orderEvent.getType() == OrderEventType.SHIPPED) {
orderStatus=OrderStatus.SHIPPED;
}
else if (orderEvent.getType() == OrderEventType.CREATED) {
orderStatus=OrderStatus.PENDING;
}
break;
case SHIPPED:
if (orderEvent.getType() == OrderEventType.DELIVERED) {
orderStatus=OrderStatus.DELIVERED;
}
else if (orderEvent.getType() == OrderEventType.ORDERED) {
orderStatus=OrderStatus.CONFIRMED;
}
break;
case DELIVERED:
if (orderEvent.getType() == OrderEventType.SHIPPED) orderStatus=OrderStatus.SHIPPED;
break;
default :
break;
}
return this;
}
| The incorporate method uses a simple state machine for an order's status to generate the current state of an order using event sourcing and aggregation. <p> The event diagram below represents how events are incorporated into generating the order status. The event log for the order status can be used to rollback the state of the order in the case of a failed distributed transaction. <p> Events: +<--PURCHASED+ +<--CREATED+ +<---ORDERED+ +<----SHIPPED+ * | | | | | | | | Status +PURCHASED---+PENDING------+CONFIRMED-----+SHIPPED--------+DELIVERED * | | | | | | | | Events: +CREATED---->+ +ORDERED-->+ +SHIPPED--->+ +DELIVERED-->+ |
@Override public void initializeLogging(){
LogWrapper logWrapper=new LogWrapper();
Log.setLogNode(logWrapper);
MessageOnlyLogFilter msgFilter=new MessageOnlyLogFilter();
logWrapper.setNext(msgFilter);
LogFragment logFragment=(LogFragment)getSupportFragmentManager().findFragmentById(R.id.log_fragment);
msgFilter.setNext(logFragment.getLogView());
logFragment.getLogView().setTextAppearance(this,R.style.Log);
logFragment.getLogView().setBackgroundColor(Color.WHITE);
Log.i(TAG,"Ready");
}
| Create a chain of targets that will receive log data |
@NonNull public <T>Observable<T> wrap(@NonNull Observable<T> observable){
return new SubscriptionManager.ManagedObservable<>(observable,this);
}
| Wraps an observable such that anything subscribed to is automatically added to this SubscriptionManager |
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. |
@SuppressWarnings("deprecation") public Cube(Column column,int cubeY,ICubePrimer primer){
this(column,cubeY);
int miny=Coords.cubeToMinBlock(cubeY);
IHeightMap opindex=column.getOpacityIndex();
for (int x=0; x < 16; x++) {
for (int z=0; z < 16; z++) {
for (int y=15; y >= 0; y--) {
IBlockState newstate=primer.getBlockState(x,y,z);
if (newstate.getMaterial() != Material.AIR) {
if (storage == null) {
newStorage();
}
storage.set(x,y,z,newstate);
if (newstate.getLightOpacity() != 0) {
column.setModified(true);
opindex.onOpacityChange(x,miny + y,z,newstate.getLightOpacity());
}
}
}
}
}
isModified=true;
}
| Create a new cube at the specified location by copying blocks from a cube primer. |
public TerminalSize(int columns,int rows){
if (columns < 0) {
throw new IllegalArgumentException("TerminalSize.columns cannot be less than 0!");
}
if (rows < 0) {
throw new IllegalArgumentException("TerminalSize.rows cannot be less than 0!");
}
this.columns=columns;
this.rows=rows;
}
| Creates a new terminal size representation with a given width (columns) and height (rows) |
public void resetStatus(){
if (status != Status.ERROR) {
status=Status.UNLOADED;
}
}
| After ApplicationState is restored from NotebookRepo, such as after Zeppelin daemon starts or Notebook import, Application status need to be reset. |
public void visit(String name,Object value){
if (av != null) {
av.visit(name,value);
}
}
| Visits a primitive value of the annotation. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
return stack.getUIMgrSafe().getVideoFrame().getDVDAvailableSubpictures();
}
| Gets a list of all of the subtitles that are currently available in the current DVD content |
private static AdvancingFrontNode newFrontTriangle(DTSweepContext tcx,TriangulationPoint point,AdvancingFrontNode node){
AdvancingFrontNode newNode;
DelaunayTriangle triangle;
triangle=new DelaunayTriangle(point,node.point,node.next.point);
triangle.markNeighbor(node.triangle);
tcx.addToList(triangle);
newNode=new AdvancingFrontNode(point);
newNode.next=node.next;
newNode.prev=node;
node.next.prev=newNode;
node.next=newNode;
tcx.addNode(newNode);
if (tcx.isDebugEnabled()) {
tcx.getDebugContext().setActiveNode(newNode);
}
if (!legalize(tcx,triangle)) {
tcx.mapTriangleToNodes(triangle);
}
return newNode;
}
| Creates a new front triangle and legalize it |
public boolean skipSpaces() throws IOException {
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0,true);
}
int c=fCurrentEntity.ch[fCurrentEntity.position];
if (XMLChar.isSpace(c)) {
boolean external=fCurrentEntity.isExternal();
do {
boolean entityChanged=false;
if (c == '\n' || (external && c == '\r')) {
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber=1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
fCurrentEntity.ch[0]=(char)c;
entityChanged=load(1,true);
if (!entityChanged) fCurrentEntity.position=0;
}
if (c == '\r' && external) {
if (fCurrentEntity.ch[++fCurrentEntity.position] != '\n') {
fCurrentEntity.position--;
}
}
}
else {
fCurrentEntity.columnNumber++;
}
if (!entityChanged) fCurrentEntity.position++;
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0,true);
}
}
while (XMLChar.isSpace(c=fCurrentEntity.ch[fCurrentEntity.position]));
return true;
}
return false;
}
| Skips space characters appearing immediately on the input. <p> <strong>Note:</strong> The characters are consumed only if they are space characters. |
@Override public Storage updateStorage(StorageAlternateKeyDto storageAlternateKey,StorageUpdateRequest storageUpdateRequest){
validateStorageAlternateKey(storageAlternateKey);
StorageEntity storageEntity=storageDaoHelper.getStorageEntity(storageAlternateKey);
storageEntity=storageDao.saveAndRefresh(storageEntity);
return createStorageFromEntity(storageEntity);
}
| Updates an existing storage. |
public static void renameTempDMLScript(String dmlScriptFile){
File oldPath=new File(dmlScriptFile + "t");
File newPath=new File(dmlScriptFile);
oldPath.renameTo(newPath);
}
| <p> Renames a temporary DML script file back to it's original name. </p> |
public static Object deepCopy(Object o){
Object result;
SerializedObject so;
try {
so=new SerializedObject((Serializable)o);
result=so.getObject();
}
catch ( Exception e) {
System.err.println("Failed to serialize " + o.getClass().getName() + ":");
e.printStackTrace();
result=null;
}
return result;
}
| Creates a deep copy of the given object (must be serializable!). Returns null in case of an error. |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case N4JSPackage.BINDING_ELEMENT__REST:
return isRest();
case N4JSPackage.BINDING_ELEMENT__VAR_DECL:
return getVarDecl();
case N4JSPackage.BINDING_ELEMENT__NESTED_PATTERN:
return getNestedPattern();
case N4JSPackage.BINDING_ELEMENT__EXPRESSION:
return getExpression();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static State valueOf(int value){
State entry=mValueToEnum.get(value);
if (entry != null) {
return entry;
}
throw new IllegalArgumentException("No enum const class " + State.class.getName() + ""+ value+ "!");
}
| Returns a State instance representing the specified integer value. |
public final int yylength(){
return zzMarkedPos - zzStartRead;
}
| Returns the length of the matched text region. |
public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh) throws org.xml.sax.SAXException {
fsb().sendSAXComment(lh,m_start,m_length);
}
| Directly call the comment method on the passed LexicalHandler for the string-value. |
void load(InputStream in) throws IOException, CryptoPolicyParser.ParsingException {
CryptoPolicyParser parser=new CryptoPolicyParser();
parser.read(new BufferedReader(new InputStreamReader(in,"UTF-8")));
CryptoPermission[] parsingResult=parser.getPermissions();
for (int i=0; i < parsingResult.length; i++) {
this.add(parsingResult[i]);
}
}
| Populates the crypto policy from the specified InputStream into this CryptoPermissions object. |
public static Object[] toComponentString(PointLatLon point){
final Object[] components={point.getLat(),point.getLon()};
return components;
}
| Splits a given point into its component string. Corresponds to a parsed (and typed) version of what toString returns. |
public static void tangent(Vector3fc v1,Vector2fc uv1,Vector3fc v2,Vector2fc uv2,Vector3fc v3,Vector2fc uv3,Vector3f dest){
float DeltaV1=uv2.y() - uv1.y();
float DeltaV2=uv3.y() - uv1.y();
float f=1.0f / ((uv2.x() - uv1.x()) * DeltaV2 - (uv3.x() - uv1.x()) * DeltaV1);
dest.x=f * (DeltaV2 * (v2.x() - v1.x()) - DeltaV1 * (v3.x() - v1.x()));
dest.y=f * (DeltaV2 * (v2.y() - v1.y()) - DeltaV1 * (v3.y() - v1.y()));
dest.z=f * (DeltaV2 * (v2.z() - v1.z()) - DeltaV1 * (v3.z() - v1.z()));
dest.normalize();
}
| Calculate the surface tangent for the three supplied vertices and UV coordinates and store the result in <code>dest</code>. |
public TaskBuilder gameTime(){
this.isRealTime=false;
return this;
}
| <b>This is default value/state of builder.</b> <br> Change task delay type to game-time, so it is tick based. <br> PS: server lag may extend the duration of tick. |
protected int[] createPalette(int size){
switch (m_type) {
case Constants.NOMINAL:
return ColorLib.getCategoryPalette(size);
case Constants.NUMERICAL:
case Constants.ORDINAL:
default :
return ColorLib.getGrayscalePalette(size);
}
}
| Create a color palette of the requested type and size. |
public void initialise(int k) throws Exception {
initialise(k,epsilon);
}
| Initialises the calculator with the existing value for epsilon |
public AdvOgreXMLConvertDialog(java.awt.Frame parent,boolean modal,OgreXMLConvertOptions options){
super(parent,modal);
this.options=options;
initComponents();
loadSettings(options);
}
| Creates new form AdvOgreXMLConvertDialog |
public synchronized void stop(){
doStop();
}
| Stops the counter monitor. |
public RawComponentScribe(String componentName){
super(RawComponent.class,componentName);
}
| Creates a new raw component scribe. |
@Override public Object eInvoke(int operationID,EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case N4JSPackage.BLOCK___APPLIES_ONLY_TO_BLOCK_SCOPED_ELEMENTS:
return appliesOnlyToBlockScopedElements();
case N4JSPackage.BLOCK___GET_ALL_STATEMENTS:
return getAllStatements();
case N4JSPackage.BLOCK___GET_ALL_RETURN_STATEMENTS:
return getAllReturnStatements();
case N4JSPackage.BLOCK___GET_ALL_NON_VOID_RETURN_STATEMENTS:
return getAllNonVoidReturnStatements();
case N4JSPackage.BLOCK___GET_ALL_VOID_RETURN_STATEMENTS:
return getAllVoidReturnStatements();
case N4JSPackage.BLOCK___HAS_NON_VOID_RETURN:
return hasNonVoidReturn();
}
return super.eInvoke(operationID,arguments);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static boolean validateBoolean(String value){
try {
Boolean.parseBoolean(value);
return true;
}
catch ( Exception e) {
return false;
}
}
| Validate boolean values. |
public void flushTemp(){
temp=new LineNumberMap(null,null);
}
| flush temporary line mappings |
public GridifyRuntimeException(String msg,Throwable cause){
super(msg,cause);
}
| Creates new gridify runtime exception with specified message and cause. |
public ContentValues resolveValueBackReferences(ContentProviderResult[] backRefs,int numBackRefs){
if (mValuesBackReferences == null) {
return mValues;
}
final ContentValues values;
if (mValues == null) {
values=new ContentValues();
}
else {
values=new ContentValues(mValues);
}
for ( Map.Entry<String,Object> entry : mValuesBackReferences.valueSet()) {
String key=entry.getKey();
Integer backRefIndex=mValuesBackReferences.getAsInteger(key);
if (backRefIndex == null) {
Log.e(TAG,this.toString());
throw new IllegalArgumentException("values backref " + key + " is not an integer");
}
values.put(key,backRefToValue(backRefs,numBackRefs,backRefIndex));
}
return values;
}
| The ContentValues back references are represented as a ContentValues object where the key refers to a column and the value is an index of the back reference whose valued should be associated with the column. <p> This is intended to be a private method but it is exposed for unit testing purposes |
public boolean isOwner(){
return owner;
}
| Returns true if this object is owned by me or is world writeable |
public IllegalAccessException(String s){
super(s);
}
| Constructs an <code>IllegalAccessException</code> with a detail message. |
private static Options createOptions(){
Options options=new Options();
Option help=new Option(OPTION_HELP,"print this message");
Option cfg=new Option(null,OPTION_CFG,true,"path to Spring XML configuration file.");
cfg.setValueSeparator('=');
cfg.setType(String.class);
Option minTtl=new Option(null,OPTION_MIN_TTL,true,"node minimum time to live.");
minTtl.setValueSeparator('=');
minTtl.setType(Long.class);
Option maxTtl=new Option(null,OPTION_MAX_TTL,true,"node maximum time to live.");
maxTtl.setValueSeparator('=');
maxTtl.setType(Long.class);
Option duration=new Option(null,OPTION_DURATION,true,"run timeout.");
duration.setValueSeparator('=');
duration.setType(Long.class);
Option log=new Option(null,OPTION_LOG_CFG,true,"path to log4j configuration file.");
log.setValueSeparator('=');
log.setType(String.class);
options.addOption(help);
OptionGroup grp=new OptionGroup();
grp.setRequired(true);
grp.addOption(cfg);
grp.addOption(minTtl);
grp.addOption(maxTtl);
grp.addOption(duration);
grp.addOption(log);
options.addOptionGroup(grp);
return options;
}
| Creates cli options. |
public static PreferenceWindow create(final Map<String,Object> values){
instance=new PreferenceWindow(null,values);
return instance;
}
| Create a preference window (a singleton) |
public static FileStore open(DataHandler handler,String name,String mode,String cipher,byte[] key,int keyIterations){
FileStore store;
if (cipher == null) {
store=new FileStore(handler,name,mode);
}
else {
store=new SecureFileStore(handler,name,mode,cipher,key,keyIterations);
}
return store;
}
| Open an encrypted file store with the given settings. |
public JSearchPanel(Visualization vis,String group,String field,boolean autoIndex,boolean monitorKeystrokes){
this(vis,group,Visualization.SEARCH_ITEMS,new String[]{field},autoIndex,true);
}
| Create a new JSearchPanel. The default search tuple set for the visualization will be used. |
public void unlockRead(long stamp){
long s, m;
WNode h;
for (; ; ) {
if (((s=state) & SBITS) != (stamp & SBITS) || (stamp & ABITS) == 0L || (m=s & ABITS) == 0L || m == WBIT) throw new IllegalMonitorStateException();
if (m < RFULL) {
if (U.compareAndSwapLong(this,STATE,s,s - RUNIT)) {
if (m == RUNIT && (h=whead) != null && h.status != 0) release(h);
break;
}
}
else if (tryDecReaderOverflow(s) != 0L) break;
}
}
| If the lock state matches the given stamp, releases the non-exclusive lock. |
public static TypeDialog createBuildNewTypeDialog(final JFrame owner,final TypeManager manager){
return new TypeDialog(owner,manager);
}
| Create dialog to build a new type. |
public Object jjtAccept(PartitionParserVisitor visitor,Object data){
return visitor.visit(this,data);
}
| Accept the visitor. |
public KDCOptions(boolean[] data) throws Asn1Exception {
super(data);
if (data.length > Krb5.KDC_OPTS_MAX + 1) {
throw new Asn1Exception(Krb5.BITSTRING_BAD_LENGTH);
}
}
| Constructs a KDCOptions from the specified bit settings. |
private ImageHostToHostCopyService.State buildImageHostToHostCopyServiceStartState(final State current,final String datastore){
ImageHostToHostCopyService.State startState=new ImageHostToHostCopyService.State();
startState.image=current.image;
startState.sourceDatastore=current.sourceImageDatastore;
startState.destinationDatastore=datastore;
startState.parentLink=this.getSelfLink();
startState.documentExpirationTimeMicros=current.documentExpirationTimeMicros;
return startState;
}
| Builds ImageHostToHostCopy service start state. |
public FitWidthImageView(Context paramContext,AttributeSet paramAttributeSet){
super(paramContext,paramAttributeSet);
}
| Instantiates a new Fit width image. |
public void write(Runnable operation){
try {
lock.writeLock().lock();
operation.run();
}
finally {
lock.writeLock().unlock();
}
}
| Obtain an exclusive write lock, perform the operation, and release the lock. |
private static int med3(char[] x,int a,int b,int c){
return (x[a] < x[b] ? (x[b] < x[c] ? b : x[a] < x[c] ? c : a) : (x[b] > x[c] ? b : x[a] > x[c] ? c : a));
}
| Returns the index of the median of the three indexed chars. |
public boolean containsAll(Collection<? extends E> c){
for ( E element : c) if (!contains(element)) return false;
return true;
}
| Returns true if all the elements of a Collection could have been inserted into the Bloom filter. Use getFalsePositiveProbability() to calculate the probability of this being correct. |
public void firePropertyChange(String name,Object oldValue,Object newValue){
pcSupport.firePropertyChange(name,oldValue,newValue);
}
| Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null. |
public void initialize(LocalDispatcher dispatcher){
this.dispatcher=dispatcher;
this.delegator=dispatcher.getDelegator();
Debug.logInfo(this.getClass().getName() + " Authenticator initialized",module);
}
| Method called when authenticator is first initialized (the delegator object can be obtained from the LocalDispatcher) |
public ModalDialogAsyncTask(int dialogStringId,final Runnable postExecuteTask){
mPostExecuteTask=postExecuteTask;
if (mProgressDialog == null) {
mProgressDialog=createProgressDialog();
}
mProgressDialog.setMessage(mActivity.getText(dialogStringId));
}
| Creates the Task with the specified string id to be shown in the dialog |
public void addListener(Class<? extends Entity> entityClass,String listenerBeanName){
lock.writeLock().lock();
try {
Set<String> set=dynamicListeners.get(entityClass);
if (set == null) {
set=new HashSet<>();
dynamicListeners.put(entityClass,set);
}
set.add(listenerBeanName);
cache.clear();
}
finally {
lock.writeLock().unlock();
}
}
| Register an entity listener which is a ManagedBean. |
public static HobbyLevel find(String value){
return enums.find(value);
}
| Searches for a parameter value that is defined as a static constant in this class. |
@Singleton @Provides Wireframe provideAndroidWireframe(BaseApp baseApp){
return new WireframeDomain(baseApp);
}
| Implements the navigation system required by the domain layer using intents in order to load the following screens |
public static boolean isDigit(char c){
return c >= '0' && c <= '9';
}
| Returns true if the specified character is a base-10 digit. |
public String generateString(){
return String.format("#%06X",0xFFFFFF & generate());
}
| Gets the inverted String equivalent of the generated shade |
private String objectToXml(Object object) throws JAXBException {
JAXBContext requestContext=JAXBContext.newInstance(object.getClass());
Marshaller requestMarshaller=requestContext.createMarshaller();
requestMarshaller.setProperty(Marshaller.JAXB_ENCODING,StandardCharsets.UTF_8.name());
requestMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
StringWriter sw=new StringWriter();
requestMarshaller.marshal(object,sw);
return sw.toString();
}
| Returns XML representation of the object. |
public boolean accept(DatagramPacket p){
if ((stunServer != null) && !stunServer.equals(p.getSocketAddress())) return false;
if (StunDatagramPacketFilter.isStunPacket(p)) {
byte[] data=p.getData();
int offset=p.getOffset();
byte b0=data[offset];
byte b1=data[offset + 1];
char method=(char)((b0 & 0xFE) | (b1 & 0xEF));
return acceptMethod(method);
}
return false;
}
| Determines whether a specific <tt>DatagramPacket</tt> represents a STUN message and whether it is part of the communication with the STUN server if one was associated with this instance. |
public void update(byte[] in,int off,int len){
if (preSig == null) {
while (len > 0 && messageLength < mBuf.length) {
this.update(in[off]);
off++;
len--;
}
}
if (len > 0) {
digest.update(in,off,len);
}
}
| update the internal digest with the byte array in |
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
request.getSession().setAttribute("school","sptc");
response.sendRedirect("servlet/SchoolServlet");
return;
}
| The doGet method of the servlet. <br> This method is called when a form has its tag value method equals to get. |
public byte[] put(InputStream in) throws IOException {
ByteArrayOutputStream id=new ByteArrayOutputStream();
int level=0;
try {
while (true) {
if (put(id,in,level)) {
break;
}
if (id.size() > maxBlockSize / 2) {
id=putIndirectId(id);
level++;
}
}
}
catch ( IOException e) {
remove(id.toByteArray());
throw e;
}
if (id.size() > minBlockSize * 2) {
id=putIndirectId(id);
}
return id.toByteArray();
}
| Store the stream, and return the id. The stream is not closed. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.