code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static void updateObligationView(ObligationStatus status){
ObligationsView oblView;
if (!ProverHelper.isInterestingObligation(status)) {
oblView=(ObligationsView)UIHelper.findView(VIEW_ID);
}
else {
oblView=(ObligationsView)UIHelper.openView(VIEW_ID);
}
if (oblView != null) {
String moduleName=status.getObMarker().getResource().getName();
if (!oblView.getPartName().equals(PART_NAME_BASE + moduleName)) {
oblView.setPartName(PART_NAME_BASE + moduleName);
}
oblView.updateItem(status);
if (oblView.isEmpty()) {
UIHelper.getActivePage().hideView(oblView);
}
}
}
| Updates the view with the information in this obligation status message. This method hides the view if after updating the item, the view is empty (there are no more interesting obligations). Must be run from the UI thread. |
public BuilderForDnsDiscoverer gossipTimeout(Duration gossipTimeout){
super.gossipTimeout=gossipTimeout;
return this;
}
| Sets the period after which gossip times out if none is received. |
@Override public void addBatch() throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
if (this.batchedArgs == null) {
this.batchedArgs=new ArrayList<Object>();
}
this.batchedArgs.add(new BatchedBindValues(this.parameterBindings));
}
}
| JDBC 2.0 Add a set of parameters to the batch. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public EventClient(InetAddress hostAddress,int hostPort,String deviceName,String iconFile) throws IOException {
byte iconType=Packet.ICON_PNG;
if (iconFile.toLowerCase().endsWith(".jpeg")) iconType=Packet.ICON_JPEG;
if (iconFile.toLowerCase().endsWith(".jpg")) iconType=Packet.ICON_JPEG;
if (iconFile.toLowerCase().endsWith(".gif")) iconType=Packet.ICON_GIF;
FileInputStream iconFileStream=new FileInputStream(iconFile);
byte[] iconData=new byte[iconFileStream.available()];
iconFileStream.read(iconData);
hasIcon=true;
startClient(hostAddress,hostPort,deviceName,iconType,iconData);
}
| Starts a XBMC EventClient. |
public Shape3DPortrayal3D(Shape3D shape,Color color){
this(shape,appearanceForColor(color));
}
| Constructs a Shape3DPortrayal3D with the given shape and a flat opaque appearance of the given color. |
public final void invert(){
invertGeneral(this);
}
| Inverts this matrix in place. |
public void init() throws ServletException {
}
| Initialization of the servlet. <br> |
public static String removeDuplicateWhitespace(String s){
StringBuilder result=new StringBuilder();
int length=s.length();
boolean isPreviousWhiteSpace=false;
for (int i=0; i < length; i++) {
char c=s.charAt(i);
boolean thisCharWhiteSpace=Character.isWhitespace(c);
if (!(isPreviousWhiteSpace && thisCharWhiteSpace)) {
result.append(c);
}
isPreviousWhiteSpace=thisCharWhiteSpace;
}
return result.toString();
}
| Remove all duplicate whitespace characters and line terminators are replaced with a single space. |
protected boolean mapContainsTask(String map,String taskId){
return getMap(map).containsKey(taskId);
}
| Helper method to check if a map contains a taskObject with the given taskId. |
public int showDialog(){
m_Result=CANCEL_OPTION;
setVisible(true);
return m_Result;
}
| Pops up the modal dialog and waits for cancel or a selection. |
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 String toString(){
return this.blocksize_S + " " + this.blocksize_E+ " "+ this.blocksize_B+ " "+ this.blocksize_L;
}
| String representation of the revision codec data. |
public boolean isGameRule(String rule){
return rule != null && gameRules.containsKey(rule);
}
| Gets whether or not the supplied rule is defined |
public void blockCopy(int sx,int sy,int w,int h,int dx,int dy){
if (w == 0) return;
if (sx < 0 || sx + w > mColumns || sy < 0 || sy + h > mScreenRows || dx < 0 || dx + w > mColumns || dy < 0 || dy + h > mScreenRows) throw new IllegalArgumentException();
boolean copyingUp=sy > dy;
for (int y=0; y < h; y++) {
int y2=copyingUp ? y : (h - (y + 1));
TerminalRow sourceRow=allocateFullLineIfNecessary(externalToInternalRow(sy + y2));
allocateFullLineIfNecessary(externalToInternalRow(dy + y2)).copyInterval(sourceRow,sx,sx + w,dx);
}
}
| Block copy characters from one position in the screen to another. The two positions can overlap. All characters of the source and destination must be within the bounds of the screen, or else an InvalidParameterException will be thrown. |
public static boolean isTrue(String key,boolean defaultVal){
String val=valueFor(key);
if (val == null) {
return defaultVal;
}
if ("true|false".indexOf(val) == -1) {
XRLog.exception("Property '" + key + "' was requested as a boolean, but "+ "value of '"+ val+ "' is not a boolean. Check configuration.");
return defaultVal;
}
else {
return Boolean.valueOf(val).booleanValue();
}
}
| Returns true if the value is "true" (ignores case), or the default provided value if not found or if the value is not a valid boolean (true or false, ignores case). A warning is issued to the log if the property is not defined, and if the default is null. |
public OpenIntObjectHashMap(int initialCapacity,double minLoadFactor,double maxLoadFactor){
setUp(initialCapacity,minLoadFactor,maxLoadFactor);
}
| Constructs an empty map with the specified initial capacity and the specified minimum and maximum load factor. |
public static String detectImdbId(String text){
String imdb="";
if (text != null && !text.isEmpty()) {
imdb=StrgUtils.substr(text,".*(tt\\d{7}).*");
if (imdb.isEmpty()) {
imdb=StrgUtils.substr(text,".*imdb\\.com\\/Title\\?(\\d{7}).*");
if (!imdb.isEmpty()) {
imdb="tt" + imdb;
}
}
}
return imdb;
}
| gets IMDB id out of filename |
public QueryTask waitForQuery(QueryTask query,Predicate<QueryTask> predicate) throws Throwable {
return ServiceHostUtils.waitForQuery(this,REFERRER,query,predicate,this.waitIterationCount,this.waitIterationSleep);
}
| Wait for a query to returns particular information. |
public ColorRGBA(int r,int g,int b,int a){
super(new Scalar(r,g,b,a));
}
| Instantiate a 4-channel RGBA color |
@SuppressWarnings("unchecked") public <T extends BeanDescription>T introspect(JavaType type){
return (T)getClassIntrospector().forSerialization(this,type,this);
}
| Method that will introspect full bean properties for the purpose of building a bean serializer |
public boolean isDefault(){
Object oo=get_Value(COLUMNNAME_IsDefault);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Default. |
private int computeAlpha(final ISItem item){
return (int)(255 - 150 * Math.abs(item.getzPosition()));
}
| Compute the alpha value of a given item |
public p addElement(String hashcode,Element element){
addElementToRegistry(hashcode,element);
return (this);
}
| Adds an Element to the element. |
@BeforeMethod public void init(){
MockitoAnnotations.initMocks(this);
globalDataAccessService=new GlobalDataAccessService();
globalDataAccessService.platformIdentDao=platformIdentDao;
globalDataAccessService.agentStatusProvider=agentStatusProvider;
globalDataAccessService.defaultDataDao=defaultDataDao;
globalDataAccessService.eventPublisher=eventPublisher;
globalDataAccessService.log=LoggerFactory.getLogger(GlobalDataAccessService.class);
}
| Initializes mocks. Has to run before each test so that mocks are clear. |
private boolean execute(String command,File arg,List<String> lines){
ProcessBuilder pb=new ProcessBuilder(command,arg.getAbsolutePath());
pb.redirectErrorStream(true);
try {
Process proc=pb.start();
BufferedReader reader=new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;
while ((line=reader.readLine()) != null) {
lines.add(line);
}
proc.waitFor();
return proc.exitValue() == 0;
}
catch ( Exception e) {
log.error("Exception while executing: " + command + " "+ arg,e);
lines.add(e.getMessage());
return false;
}
}
| Executes a command with one argument, returning true if the command succeeds. Gathers the output from stdout and stderr into the provided list of lines. |
public AnnotationVisitor visitAnnotation(String desc,boolean visible){
if (mv != null) {
return mv.visitAnnotation(desc,visible);
}
return null;
}
| Visits an annotation of this method. |
public static void organizeDistribution(final float[] probabilities){
organizeDistribution(probabilities,false);
}
| Same as organizeDistribution(probabilities, <b>false</b>); |
public static void main(String[] args) throws Exception {
System.out.println("Checking " + Arrays.toString(args));
KeyTab ktab=KeyTab.getInstance(args[0]);
Set<String> expected=new HashSet<>();
for (int i=1; i < args.length; i+=2) {
expected.add(args[i] + ":" + args[i + 1]);
}
for ( KeyTabEntry e : ktab.getEntries()) {
String vne=e.getKey().getKeyVersionNumber() + ":" + e.getKey().getEType();
if (!expected.contains(vne)) {
throw new Exception("No " + vne + " in expected");
}
expected.remove(vne);
}
if (!expected.isEmpty()) {
throw new Exception("Extra elements in expected");
}
}
| Checks if a keytab contains exactly the keys (kvno and etype) |
public boolean hasActiveTasks(){
return mActiveTasks.size() > 0;
}
| Get whether there are any running JS tasks at the moment. |
protected TAnnotationStringArgumentImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void assertDownloaderManifest(DownloaderInputManifestDto expectedDownloaderInputManifest,DownloaderInputManifestDto actualDownloaderInputManifest){
assertEquals(expectedDownloaderInputManifest.getBusinessObjectDefinitionName(),actualDownloaderInputManifest.getBusinessObjectDefinitionName());
assertEquals(expectedDownloaderInputManifest.getBusinessObjectFormatUsage(),actualDownloaderInputManifest.getBusinessObjectFormatUsage());
assertEquals(expectedDownloaderInputManifest.getBusinessObjectFormatFileType(),actualDownloaderInputManifest.getBusinessObjectFormatFileType());
assertEquals(expectedDownloaderInputManifest.getBusinessObjectFormatVersion(),actualDownloaderInputManifest.getBusinessObjectFormatVersion());
assertEquals(expectedDownloaderInputManifest.getPartitionKey(),actualDownloaderInputManifest.getPartitionKey());
assertEquals(expectedDownloaderInputManifest.getPartitionValue(),actualDownloaderInputManifest.getPartitionValue());
assertEquals(expectedDownloaderInputManifest.getBusinessObjectDataVersion(),actualDownloaderInputManifest.getBusinessObjectDataVersion());
}
| Validates downloader input manifest instance. |
public double mean(){
return mu;
}
| Returns the mean of the data values. |
public boolean hasAltitude(){
return mHasAltitude;
}
| True if this location has an altitude. |
public final byte[] generateSecret() throws IllegalStateException {
return spiImpl.engineGenerateSecret();
}
| Generates the shared secret. |
@Override public void run(){
amIActive=true;
String inputFilesString=null;
String whiteboxHeaderFile=null;
String whiteboxDataFile=null;
WhiteboxRaster output=null;
int i=0;
String[] imageFiles;
int numImages=0;
double noData=-32768;
int progress=0;
String str1=null;
FileWriter fw=null;
BufferedWriter bw=null;
PrintWriter out=null;
if (args.length <= 0) {
showFeedback("Plugin parameters have not been set.");
return;
}
inputFilesString=args[0];
if ((inputFilesString == null)) {
showFeedback("One or more of the input parameters have not been set properly.");
return;
}
imageFiles=inputFilesString.split(";");
numImages=imageFiles.length;
try {
String returnedHeader="";
for (i=0; i < numImages; i++) {
if (numImages > 1) {
updateProgress("Loop " + (i + 1) + " of "+ numImages+ ":",progress);
}
GeoTiff gt=new GeoTiff(imageFiles[i]);
gt.read();
int compressionType=gt.getCompressionType();
if (compressionType != 1) {
showFeedback("GeoTiff import does not currently support compressed files.");
return;
}
boolean hasNoDataValue=gt.hasNoDataTag();
double nodata;
if (hasNoDataValue) {
nodata=gt.getNoData();
}
else {
nodata=-32768;
}
int nRows=gt.getNumberRows();
int nCols=gt.getNumberColumns();
int dot=imageFiles[i].lastIndexOf(".");
String tiffExtension=imageFiles[i].substring(dot + 1);
whiteboxHeaderFile=imageFiles[i].replace(tiffExtension,"dep");
if (i == 0) {
returnedHeader=whiteboxHeaderFile;
}
whiteboxDataFile=imageFiles[i].replace(tiffExtension,"tas");
(new File(whiteboxHeaderFile)).delete();
(new File(whiteboxDataFile)).delete();
ByteOrder byteOrder=gt.getByteOrder();
WhiteboxRasterBase.DataScale myDataScale=WhiteboxRasterBase.DataScale.CONTINUOUS;
if (gt.getPhotometricInterpretation() == 2) {
myDataScale=WhiteboxRasterBase.DataScale.RGB;
}
final WhiteboxRaster wbr=new WhiteboxRaster(whiteboxHeaderFile,gt.getNorth(),gt.getSouth(),gt.getEast(),gt.getWest(),nRows,nCols,myDataScale,WhiteboxRasterBase.DataType.FLOAT,nodata,nodata);
wbr.setByteOrder(byteOrder.toString());
double z;
int oldProgress=-1;
for (int row=0; row < nRows; row++) {
for (int col=0; col < nCols; col++) {
z=gt.getValue(row,col);
if (!hasNoDataValue && (z == -32768 || z == -Float.MAX_VALUE)) {
nodata=z;
hasNoDataValue=true;
wbr.setNoDataValue(nodata);
}
wbr.setValue(row,col,z);
}
progress=(int)(100f * row / (nRows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress("Importing GeoTiff file...",progress);
}
}
wbr.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
wbr.addMetadataEntry("Created on " + new Date());
String[] metaData=gt.showInfo();
for (int a=0; a < metaData.length; a++) {
wbr.addMetadataEntry(metaData[a]);
}
wbr.close();
gt.close();
}
if (!returnedHeader.isEmpty()) {
returnData(returnedHeader);
}
}
catch ( OutOfMemoryError oe) {
myHost.showFeedback("An out-of-memory error has occurred during operation.");
}
catch ( Exception e) {
myHost.showFeedback("An error has occurred during operation. See log file for details.");
myHost.logException("Error in " + getDescriptiveName(),e);
}
finally {
if (out != null || bw != null) {
out.flush();
out.close();
}
updateProgress("Progress: ",0);
amIActive=false;
myHost.pluginComplete();
}
}
| Used to execute this plugin tool. |
private int readArgumentIndex(final String pattern,final ParsePosition pos){
final int start=pos.getIndex();
seekNonWs(pattern,pos);
final StringBuilder result=new StringBuilder();
boolean error=false;
for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
char c=pattern.charAt(pos.getIndex());
if (Character.isWhitespace(c)) {
seekNonWs(pattern,pos);
c=pattern.charAt(pos.getIndex());
if (c != START_FMT && c != END_FE) {
error=true;
continue;
}
}
if ((c == START_FMT || c == END_FE) && result.length() > 0) {
try {
return Integer.parseInt(result.toString());
}
catch ( final NumberFormatException e) {
}
}
error=!Character.isDigit(c);
result.append(c);
}
if (error) {
throw new IllegalArgumentException("Invalid format argument index at position " + start + ": "+ pattern.substring(start,pos.getIndex()));
}
throw new IllegalArgumentException("Unterminated format element at position " + start);
}
| Read the argument index from the current format element |
private Assert(){
}
| Don't allow construction, all methods are static. |
public void scrollPathToVisible(TreePath path){
if (path != null) {
makeVisible(path);
Rectangle bounds=getPathBounds(path);
if (bounds != null) {
scrollRectToVisible(bounds);
if (accessibleContext != null) {
((AccessibleJTree)accessibleContext).fireVisibleDataPropertyChange();
}
}
}
}
| Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed. Only works when this <code>JTree</code> is contained in a <code>JScrollPane</code>. |
@Override public Object visit(Variable var){
return Register.createLocal(var.getSlot(),var.getSymbol().getType());
}
| Variable reference: push an operand which will fetch the appropriate stack frame slot. |
public static <T>ObjectAnimator ofFloat(T target,Property<T,Float> property,float... values){
ObjectAnimator anim=new ObjectAnimator(target,property);
anim.setFloatValues(values);
return anim;
}
| Constructs and returns an ObjectAnimator that animates between float values. A single value implies that that value is the one being animated to. Two values imply a starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). |
public boolean toggle(boolean state){
final int oldScrewState=screwState;
this.screwState=state ? 1 : 0;
if (oldScrewState != screwState) markForUpdate();
return oldScrewState != screwState;
}
| Toggles the cheese press state |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:56:15.143 -0500",hash_original_method="6FEED072B476DF683299871B82C2E47E",hash_generated_method="D1C8F57605DACB183A09E1BEE2EA4F5E") @Deprecated public static void runFinalizersOnExit(boolean run){
finalizeOnExit=run;
}
| Sets the flag that indicates whether all objects are finalized when the VM is about to exit. Note that all finalization which occurs when the system is exiting is performed after all running threads have been terminated. |
public OutputStream put(String key) throws FileNotFoundException {
return new xFileOutputStream(mCache.newFile(key));
}
| Cache for a stream |
public VNXeCommandJob createFileSystemSnap(String fsId,String name){
_logger.info("creating file system snap:" + fsId);
String resourceId=getStorageResourceId(fsId);
FileSystemSnapCreateParam parm=new FileSystemSnapCreateParam();
VNXeBase resource=new VNXeBase();
resource.setId(resourceId);
parm.setStorageResource(resource);
parm.setName(name);
parm.setIsReadOnly(false);
FileSystemSnapRequests req=new FileSystemSnapRequests(_khClient,getBasicSystemInfo().getSoftwareVersion());
return req.createFileSystemSnap(parm);
}
| Create file system snapshot |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:35:07.174 -0500",hash_original_method="DE018C3EFE6320C8CBFF22F7586A6AFE",hash_generated_method="99D4E31A8067C1F45C3E6784449B085B") public void translateWindowLayout(WindowManager.LayoutParams params){
params.scale(applicationScale);
}
| Translate the window's layout parameter, from application's view to Screen's view. |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
long[] ls=stack.getUIMgrSafe().getIRCodesForUE(UserEvent.getEvtCodeForName(getString(stack)));
Long[] rv=new Long[ls.length];
for (int i=0; i < ls.length; i++) rv[i]=new Long(ls[i]);
return rv;
}
| Returns the infrared codes that are linked to the given SageTV Command. When one of these IR codes is received; that will cause the specified SageTV Command to get executed. |
@Override public Void apply(ErrorMessage errorMessage){
return null;
}
| Does not do anything. |
public Builder defaultHeaderTypefacePath(String typefacePath){
this.defaultHeaderTypefacePath=typefacePath;
return this;
}
| Set the path to a typeface (in assets) to be used by default for headers |
public static DoubleMatrix2D div(DoubleMatrix2D A,double s){
return A.assign(F.div(s));
}
| <tt>A = A / s <=> A[row,col] = A[row,col] / s</tt>. |
public void addFatalError(Message message) throws CompilationFailedException {
addError(message);
failIfErrors();
}
| Adds a fatal exception to the message set and throws the unit as a PhaseFailedException. |
public BeanContextServiceAvailableEvent(BeanContextServices bcs,Class sc){
super((BeanContext)bcs);
serviceClass=sc;
}
| Construct a <code>BeanContextAvailableServiceEvent</code>. |
public int height(){
if (root == null) {
return 0;
}
return root.height();
}
| Helper method for testing. |
public static void swap(short[] array){
for (int i=0; i < array.length; i++) array[i]=swap(array[i]);
}
| Byte swap an array of shorts. The result of the swapping is put back into the specified array. |
public boolean isRelease(){
return release;
}
| Getters and Setters. Autogenerated by IntelliJ IDEA |
private boolean mkdirs0(@Nullable File dir){
if (dir == null) return true;
if (dir.exists()) return dir.isDirectory();
else {
File parentDir=dir.getParentFile();
if (!mkdirs0(parentDir)) return false;
boolean res=dir.mkdir();
if (!res) res=dir.exists();
return res;
}
}
| Create directories. |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public Object clone() throws java.lang.CloneNotSupportedException {
return (super.clone());
}
| Method clone. |
protected boolean beforeSave(boolean newRecord){
return true;
}
| Before Save |
public final Mono<T> awaitOnSubscribe(){
return onAssembly(new MonoAwaitOnSubscribe<>(this));
}
| Intercepts the onSubscribe call and makes sure calls to Subscription methods only happen after the child Subscriber has returned from its onSubscribe method. <p>This helps with child Subscribers that don't expect a recursive call from onSubscribe into their onNext because, for example, they request immediately from their onSubscribe but don't finish their preparation before that and onNext runs into a half-prepared state. This can happen with non Reactor based Subscribers. |
public void install(Router router){
BridgeOptions bridgeOptions=new BridgeOptions().addOutboundPermitted(new PermittedOptions().setAddressRegex(addressPrefix + "(.*)"));
if (eventbusBridgePingInterval != null) {
bridgeOptions=bridgeOptions.setPingTimeout(eventbusBridgePingInterval);
}
router.route(sockPath).handler(SockJSHandler.create(vertx).bridge(bridgeOptions));
log.info("Installed SockJS endpoint on " + sockPath);
log.info("Listening to requests on " + adressPathPattern.pattern());
log.info("Using address prefix " + addressPrefix);
}
| Configures and binds the SockJS bridge to an HttpServer. |
public void shutdown(){
log.info("Shutting down CoreContainer instance=" + System.identityHashCode(this));
isShutDown=true;
ExecutorUtil.shutdownAndAwaitTermination(coreContainerWorkExecutor);
if (isZooKeeperAware()) {
cancelCoreRecoveries();
zkSys.zkController.publishNodeAsDown(zkSys.zkController.getNodeName());
}
try {
if (coreAdminHandler != null) coreAdminHandler.shutdown();
}
catch ( Exception e) {
log.warn("Error shutting down CoreAdminHandler. Continuing to close CoreContainer.",e);
}
try {
synchronized (solrCores.getModifyLock()) {
solrCores.getModifyLock().notifyAll();
}
if (backgroundCloser != null) {
try {
backgroundCloser.join();
}
catch ( InterruptedException e) {
Thread.currentThread().interrupt();
if (log.isDebugEnabled()) {
log.debug("backgroundCloser thread was interrupted before finishing");
}
}
}
solrCores.close();
synchronized (solrCores.getModifyLock()) {
solrCores.getModifyLock().notifyAll();
}
}
finally {
try {
if (shardHandlerFactory != null) {
shardHandlerFactory.close();
}
}
finally {
try {
if (updateShardHandler != null) {
updateShardHandler.close();
}
}
finally {
zkSys.close();
}
}
}
try {
if (authorizationPlugin != null) {
authorizationPlugin.plugin.close();
}
}
catch ( IOException e) {
log.warn("Exception while closing authorization plugin.",e);
}
try {
if (authenticationPlugin != null) {
authenticationPlugin.plugin.close();
authenticationPlugin=null;
}
}
catch ( Exception e) {
log.warn("Exception while closing authentication plugin.",e);
}
org.apache.lucene.util.IOUtils.closeWhileHandlingException(loader);
}
| Stops all cores. |
private static Point2D.Double[] generateBezier(ArrayList<Point2D.Double> d,int first,int last,double[] uPrime,Point2D.Double tHat1,Point2D.Double tHat2){
Point2D.Double[] bezCurve;
bezCurve=new Point2D.Double[4];
for (int i=0; i < bezCurve.length; i++) {
bezCurve[i]=new Point2D.Double();
}
double dist=v2DistanceBetween2Points(d.get(last),d.get(first)) / 3.0;
bezCurve[0]=d.get(first);
bezCurve[3]=d.get(last);
v2Add(bezCurve[0],v2Scale(tHat1,dist),bezCurve[1]);
v2Add(bezCurve[3],v2Scale(tHat2,dist),bezCurve[2]);
return (bezCurve);
}
| Use least-squares method to find Bezier control points for region. |
public void tagRemoveObject(int charId,int depth) throws IOException {
startTag(TAG_REMOVEOBJECT,false);
out.writeUI16(charId);
out.writeUI16(depth);
completeTag();
}
| SWFTagTypes interface |
public void testCreateExistingLocalConfigurationWhenNoHomeDirectorySpecified(){
this.factory.registerConfiguration("testableContainerId",ContainerType.INSTALLED,ConfigurationType.EXISTING,ExistingLocalConfigurationStub.class);
try {
this.factory.createConfiguration("testableContainerId",ContainerType.INSTALLED,ConfigurationType.EXISTING);
fail("An exception should have been raised");
}
catch ( ContainerException expected) {
assertEquals("The configuration home parameter must be specified for existing " + "configurations",expected.getOriginalThrowable().getMessage());
}
}
| Test existing local configuration creation when no home directory specified. |
public void infoCode(String java){
if (isEnabled(TraceSystem.INFO)) {
traceWriter.write(TraceSystem.INFO,java,null);
}
}
| Write Java source code with trace level INFO to the trace system. |
public static IndexType createUnique(boolean hash){
IndexType type=new IndexType();
type.unique=true;
type.hash=hash;
return type;
}
| Create a unique index. |
@Nullable private S3CheckpointData read(String key) throws IgniteCheckedException, AmazonClientException {
assert !F.isEmpty(key);
if (log.isDebugEnabled()) log.debug("Reading data from S3 [bucket=" + bucketName + ", key="+ key+ ']');
try {
S3Object obj=s3.getObject(bucketName,key);
InputStream in=obj.getObjectContent();
try {
return S3CheckpointData.fromStream(in);
}
catch ( IOException e) {
throw new IgniteCheckedException("Failed to unmarshal S3CheckpointData [bucketName=" + bucketName + ", key="+ key+ ']',e);
}
finally {
U.closeQuiet(in);
}
}
catch ( AmazonServiceException e) {
if (e.getStatusCode() != 404) throw e;
}
return null;
}
| Reads checkpoint data. |
public void updatePreviousRunStatus(final String previousRunStatus){
if (!StringUtils.isEmpty(previousRunStatus)) {
this.previousRunStatus=previousRunStatus;
}
}
| update the previousRunStatus |
public void runTest() throws Throwable {
Document doc;
NodeList addressList;
Node testNode;
NamedNodeMap attributes;
Attr streetAttr;
String value;
doc=(Document)load("staff",false);
addressList=doc.getElementsByTagName("address");
testNode=addressList.item(0);
attributes=testNode.getAttributes();
streetAttr=(Attr)attributes.getNamedItem("street");
value=streetAttr.getNodeValue();
assertEquals("attrDefaultValueAssert","Yes",value);
}
| Runs the test case. |
public boolean isLocateAtCenter(){
return locateAtCenter;
}
| Get whether the LabeledOMGraphic is placing the label String in the center of the OMGraphic. |
public void release(){
if (config.managed) {
assert refs > 0 : "Released a texture with no references!";
if (--refs == 0) close();
}
}
| Decrements this texture's reference count. If the reference count of a managed texture goes to zero, the texture is disposed (and is no longer usable). |
public void endStartLocator(InternalDistributedSystem distributedSystem) throws UnknownHostException {
env=null;
if (distributedSystem == null) {
distributedSystem=InternalDistributedSystem.getConnectedInstance();
}
if (distributedSystem != null) {
onConnect(distributedSystem);
}
else {
InternalDistributedSystem.addConnectListener(this);
}
this.locatorDiscoverer=WANServiceProvider.createLocatorDiscoverer();
if (this.locatorDiscoverer != null) {
this.locatorDiscoverer.discover(getPort(),config,locatorListener,hostnameForClients);
}
}
| End the initialization of the locator. This method should be called once the location services and distributed system are started. |
public static String convertGLUTessErrorToString(int errno){
switch (errno) {
case GLU.GLU_TESS_MISSING_BEGIN_POLYGON:
return "missing begin polygon";
case GLU.GLU_TESS_MISSING_END_POLYGON:
return "missing end polygon";
case GLU.GLU_TESS_MISSING_BEGIN_CONTOUR:
return "missing begin contour";
case GLU.GLU_TESS_MISSING_END_CONTOUR:
return "missing end contour";
case GLU.GLU_TESS_COORD_TOO_LARGE:
return "coordinate too large";
case GLU.GLU_TESS_NEED_COMBINE_CALLBACK:
return "need combine callback";
default :
return "unknown";
}
}
| Converts the specified GLU tessellator error number to a string description. This returns "unknown" if the error number is not recognized. |
public Configuration(final String url) throws JAXBException {
_dsDispatcher=new DSDispatcher();
_uriBuilder=new UriBuilder();
List<String> _matrixParamSet;
_matrixParamSet=_uriBuilder.addPathSegment(url);
_matrixParamSet=_uriBuilder.addPathSegment("system");
_matrixParamSet=_uriBuilder.addPathSegment("configuration");
_templateAndMatrixParameterValues=new HashMap<String,Object>();
}
| Create new instance |
@DSComment("OS Bundle data structure") @DSSafe(DSCat.DATA_STRUCTURE) @DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:36.463 -0500",hash_original_method="48338BC49C4A94D5C3F73368CEF11822",hash_generated_method="40E5D56C660E674AEAC1983F06C125A3") public void putShort(String key,short value){
unparcel();
mMap.put(key,value);
}
| Inserts a short value into the mapping of this Bundle, replacing any existing value for the given key. |
private static void read(IgniteFileSystem fs,IgfsPath path) throws IgniteException, IOException {
assert fs != null;
assert path != null;
assert fs.info(path).isFile();
byte[] data=new byte[(int)fs.info(path).length()];
try (IgfsInputStream in=fs.open(path)){
in.read(data);
}
System.out.println();
System.out.println(">>> Read data from " + path + ": "+ Arrays.toString(data));
}
| Opens file and reads it to byte array. |
@Override public void run(){
try {
logger.info("Beginning Code Verification. Echoing environmental data...");
echoEnvironment();
logger.info("Starting Code Verification in 5 seconds...");
Thread.sleep(5 * 1000);
logger.info("Transferring into Autonomous... (Switching to Teleop in 15 seconds)");
SimulationData.currentState=RobotState.AUTONOMOUS;
Thread.sleep(15 * 1000);
logger.info("Transferring into Teleoperated... (Switching to Disabled in 1 minute)");
SimulationData.currentState=RobotState.TELEOP;
Thread.sleep(60 * 1000);
logger.info("Disabling Robot... (Shutting Down in 10 seconds)");
SimulationData.currentState=RobotState.DISABLED;
Thread.sleep(10 * 1000);
logger.info("Code Verification Successful! Shutting Down...");
Toast.getToast().shutdownSafely();
}
catch ( Exception e) {
logger.error("Exception encountered during verification: " + e);
logger.exception(e);
Toast.getToast().shutdownCrash();
}
}
| Run a single loop of the Verification Routine. |
protected void checkLoopExplosionIteration(MethodScope methodScope,LoopScope loopScope){
throw shouldNotReachHere("when subclass uses loop explosion, it needs to implement this method");
}
| Hook for subclasses. |
public Builder toBuilder(){
return newBuilder().readRoles(readRoles).writeRoles(writeRoles).deleteRoles(deleteRoles).metaReadRoles(metaReadRoles).metaWriteRoles(metaWriteRoles);
}
| Creates a new stream access-control-list builder populated with the values from this instance. |
public ClassPath(){
String syscp=System.getProperty("sun.boot.class.path");
String envcp=System.getProperty("env.class.path");
if (envcp == null) envcp=".";
String cp=syscp + File.pathSeparator + envcp;
init(cp);
}
| Build a default class path from the path strings specified by the properties sun.boot.class.path and env.class.path, in that order. |
public JarInfo loadJar() throws IOException {
ZipInputStream zis=null;
Manifest mf=null;
boolean empty=true;
try {
zis=new ZipInputStream(jarStream);
ZipEntry ent=null;
while ((ent=zis.getNextEntry()) != null) {
empty=false;
String name=ent.getName();
if (Manifest.isManifestName(name)) {
ByteArrayOutputStream baos=new ByteArrayOutputStream();
byte buffer[]=new byte[1024];
for (; ; ) {
int len=zis.read(buffer);
if (len < 0) {
break;
}
baos.write(buffer,0,len);
}
byte[] buf=baos.toByteArray();
mf=new Manifest(buf);
}
}
}
catch ( IOException ex) {
throw ex;
}
catch ( Throwable th) {
th.printStackTrace();
throw new IOException("loadJar caught: " + th);
}
finally {
if (zis != null) {
try {
zis.close();
}
catch ( Exception ex) {
}
}
}
if (empty) {
throw new IOException("JAR file is corrupt or empty");
}
JarInfo ji=createJarInfo(mf);
return ji;
}
| Load the classes, resources, etc. |
public String detect() throws LangDetectException {
ArrayList<Language> probabilities=getProbabilities();
if (probabilities.size() > 0) return probabilities.get(0).lang;
return UNKNOWN_LANG;
}
| Detect language of the target text and return the language name which has the highest probability. |
public void deleteAttributeAt(int columnIndex,boolean notify){
if ((columnIndex > 0) && (columnIndex < getColumnCount())) {
if (!m_IgnoreChanges) {
addUndoPoint();
}
m_Data.deleteAttributeAt(columnIndex - 1);
if (notify) {
notifyListener(new TableModelEvent(this,TableModelEvent.HEADER_ROW));
}
}
}
| deletes the attribute at the given col index |
public void fireGenerateEvent(int eventType,String data){
}
| Fire off comment and entity ref events. |
public HessianMethodSerializationException(Throwable cause){
super(cause);
}
| Create the exception. |
public R scan(TreePath path,P p){
this.path=path;
try {
return path.getLeaf().accept(this,p);
}
finally {
this.path=null;
}
}
| Scan a tree from a position identified by a TreePath. |
@Override public boolean handles(Class cls){
return true;
}
| Checks whether the renderer can handle the specified class. |
public MemoryDocValuesFormat(float acceptableOverheadRatio){
super("Memory");
this.acceptableOverheadRatio=acceptableOverheadRatio;
}
| Creates a new MemoryDocValuesFormat with the specified <code>acceptableOverheadRatio</code> for NumericDocValues. |
public void scale(int width,int height){
image=Display.impl.scale(image,width,height);
}
| Scale the image to the given width and height, this is a fast algorithm that preserves translucent information |
private void generateStructure(jplagWebService.server.Option usr_opt,String argsInString) throws JPlagException {
Vector<String> vec=new Vector<String>();
vec.add("JPlag");
vec.add("-vp");
vec.add("-vq");
if (usr_opt.isReadSubdirs()) vec.add("-s");
if (isSet(usr_opt.getPathToFiles())) {
vec.add("-S");
vec.add(usr_opt.getPathToFiles());
}
vec.add("-m");
String tmpmatch=usr_opt.getStoreMatches();
if (!isSet(tmpmatch)) {
vec.add(DEFAULT_STORABLE + "");
}
else {
int index=tmpmatch.indexOf("%");
try {
if (index != -1) {
tmpmatch=tmpmatch.substring(0,index);
int percent=Integer.parseInt(tmpmatch);
if (percent > 100) {
throw new JPlagException("optionsException","Illegal store matches option specified!","There can't be a similarity bigger than 100%!");
}
tmpmatch+="%";
}
else {
int nummatches=Integer.parseInt(tmpmatch);
if (nummatches > MAX_STORABLE) nummatches=MAX_STORABLE;
if (nummatches < MIN_STORABLE) nummatches=MIN_STORABLE;
tmpmatch=nummatches + "";
}
}
catch ( NumberFormatException ex) {
throw new JPlagException("optionsException","Illegal store matches option specified!","Please check the usage function for correct " + "store_matches format");
}
vec.add(tmpmatch);
}
vec.add("-compmode");
if (usr_opt.getComparisonMode() == null) vec.add(jplag.options.Options.COMPMODE_NORMAL + "");
else vec.add(usr_opt.getComparisonMode().toString());
vec.add("-clang");
vec.add(usr_opt.getCountryLang());
if (usr_opt.getSuffixes().length != 0) {
vec.add("-p");
String str="";
String[] suffixes=usr_opt.getSuffixes();
for (int i=0; i < suffixes.length; i++) {
str+=suffixes[i];
if (i != suffixes.length - 1) str+=",";
}
vec.add(str);
}
if (isSet(usr_opt.getBasecodeDir())) {
vec.add("-bc");
vec.add(usr_opt.getBasecodeDir());
}
if (isSet(usr_opt.getClustertype())) {
vec.add("-clustertype");
vec.add(usr_opt.getClustertype());
}
String language=usr_opt.getLanguage();
int languagenum;
for (languagenum=0; languagenum < JPlagTypImpl.languageInfos.length; languagenum++) {
if (JPlagTypImpl.languageInfos[languagenum].getName().equals(language)) {
vec.add("-l");
vec.add(language);
break;
}
}
if (languagenum == JPlagTypImpl.languageInfos.length) {
System.out.println("Wrong language specified: " + language);
throw new JPlagException("optionsException","Illegal language specified!","Use getServerInfo to see which languages are supported " + "and how they are spelled!");
}
int mintoklen=usr_opt.getMinimumMatchLength();
if (mintoklen <= 0) mintoklen=JPlagTypImpl.languageInfos[languagenum].getDefMinMatchLen();
vec.add("-t");
vec.add(mintoklen + "");
String submissiondir=submissionID + username;
String result_dir=JPLAG_RESULTS_DIRECTORY + File.separator + submissiondir;
vec.add("-r");
vec.add(result_dir);
vec.add("-o");
File file12s=new File(result_dir);
if (!(file12s.exists())) file12s.mkdir();
String tmp11st=result_dir + File.separator + PARSERLOG;
vec.add(tmp11st);
vec.add("-d");
vec.add(usr_opt.getOriginalDir());
vec.add("-title");
vec.add(usr_opt.getTitle());
vec.add(JPLAG_ENTRIES_DIRECTORY + File.separator + submissiondir);
try {
String[] args=new String[vec.size()];
for (int i=0; i < args.length; i++) args[i]=vec.elementAt(i);
options=new jplag.options.CommandLineOptions(args,argsInString);
getDecorator().add(options.getState(),options.getProgress(),"");
}
catch ( jplag.ExitException e) {
throw new JPlagException("invalidOptionsException",e.getReport(),"Check your options");
}
}
| This method is used to translate a jplag.server.Option object to a jplag.options.CommandLineOptions object |
public final boolean canBeSeenBy(Scope scope){
if (isPublic()) return true;
SourceTypeBinding invocationType=scope.enclosingSourceType();
if (invocationType == this) return true;
if (invocationType == null) return !isPrivate() && scope.getCurrentPackage() == this.fPackage;
if (isProtected()) {
if (invocationType.fPackage == this.fPackage) return true;
TypeBinding declaringClass=enclosingType();
if (declaringClass == null) return false;
declaringClass=declaringClass.erasure();
TypeBinding currentType=invocationType.erasure();
do {
if (declaringClass == invocationType) return true;
if (currentType.findSuperTypeOriginatingFrom(declaringClass) != null) return true;
currentType=currentType.enclosingType();
}
while (currentType != null);
return false;
}
if (isPrivate()) {
ReferenceBinding outerInvocationType=invocationType;
ReferenceBinding temp=outerInvocationType.enclosingType();
while (temp != null) {
outerInvocationType=temp;
temp=temp.enclosingType();
}
ReferenceBinding outerDeclaringClass=(ReferenceBinding)erasure();
temp=outerDeclaringClass.enclosingType();
while (temp != null) {
outerDeclaringClass=temp;
temp=temp.enclosingType();
}
return outerInvocationType == outerDeclaringClass;
}
return invocationType.fPackage == this.fPackage;
}
| Answer true if the receiver is visible to the type provided by the scope. |
public final int yystate(){
return zzLexicalState;
}
| Returns the current lexical state. |
@NamespacePermissions({@NamespacePermission(fields="#request.businessObjectDataNotificationRegistrationKey.namespace",permissions=NamespacePermissionEnum.WRITE),@NamespacePermission(fields="#request.businessObjectDataNotificationFilter.namespace",permissions=NamespacePermissionEnum.READ),@NamespacePermission(fields="#request.jobActions.![namespace]",permissions=NamespacePermissionEnum.EXECUTE)}) private void mockMethod(BusinessObjectDataNotificationRegistrationCreateRequest request){
}
| Do not invoke this method. This method is a test input for reflection related tests. The most complex case we have so far: a mock simulation of notification registration, where there are 3 different permissions on namespaces, and one of them is a collection. |
private void addField(MetaClass metaClass,MetaProperty metaProperty,Entity item,FieldGroup fieldGroup,boolean required,boolean custom,boolean readOnly,Collection<FieldGroup.FieldConfig> customFields){
if (!attrViewPermitted(metaClass,metaProperty)) return;
if ((metaProperty.getType() == MetaProperty.Type.COMPOSITION || metaProperty.getType() == MetaProperty.Type.ASSOCIATION) && !entityOpPermitted(metaProperty.getRange().asClass(),EntityOp.READ)) return;
FieldGroup.FieldConfig field=new FieldGroup.FieldConfig(metaProperty.getName());
String caption=getPropertyCaption(metaClass,metaProperty);
field.setCaption(caption);
field.setType(metaProperty.getJavaType());
field.setWidth(themeConstants.get("cuba.gui.EntityInspectorEditor.field.width"));
field.setCustom(custom);
field.setRequired(required);
field.setEditable(!readOnly);
field.setWidth("100%");
if (requireTextArea(metaProperty,item)) {
Element root=DocumentHelper.createElement("textArea");
root.addAttribute("rows","3");
field.setXmlDescriptor(root);
}
if (focusFieldId == null && !readOnly) {
focusFieldId=field.getId();
focusFieldGroup=fieldGroup;
}
if (required) {
MessageTools messageTools=AppBeans.get(MessageTools.NAME);
field.setRequiredError(messageTools.getDefaultRequiredMessage(metaClass,metaProperty.getName()));
}
fieldGroup.addField(field);
if (custom) customFields.add(field);
}
| Adds field to the specified field group. If the field should be custom, adds it to the specified customFields collection which can be used later to create fieldGenerators |
public static void pushParameter(double o){
parametersDouble.push(o);
}
| <p> pushParameter </p> |
public static SelectorExtractor selector(String query,int eq){
return new SelectorExtractor(query,eq);
}
| return a selector extractor for xml. |
public Matrix3f multLocal(float scale){
m00*=scale;
m01*=scale;
m02*=scale;
m10*=scale;
m11*=scale;
m12*=scale;
m20*=scale;
m21*=scale;
m22*=scale;
return this;
}
| <code>multLocal</code> multiplies this matrix internally by a given float scale factor. |
private int startFrame(final int offset,final int nLocal,final int nStack){
int n=3 + nLocal + nStack;
if (frame == null || frame.length < n) {
frame=new int[n];
}
frame[0]=offset;
frame[1]=nLocal;
frame[2]=nStack;
return 3;
}
| Starts the visit of a stack map frame. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.