code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd,int featureID,NotificationChain msgs){
switch (featureID) {
case TypesPackage.FIELD_ACCESSOR__DECLARED_THIS_TYPE:
return basicSetDeclaredThisType(null,msgs);
}
return super.eInverseRemove(otherEnd,featureID,msgs);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Override public void put(String name,boolean value){
emulatedFields.put(name,value);
}
| Find and set the boolean value of a given field named <code>name</code> in the receiver. |
public boolean isStrict(){
return strict;
}
| Returns the strictness setting for query parameter parsing on the server. |
protected void sequence_ModuleFilterSpecifier(ISerializationContext context,ModuleFilterSpecifier semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: ModuleFilterSpecifier returns ModuleFilterSpecifier Constraint: (moduleSpecifierWithWildcard=STRING sourcePath=STRING?) |
public final static boolean isNonSeparator(char c){
return (c >= '0' && c <= '9') || c == '*' || c == '#' || c == '+' || c == WILD || c == WAIT || c == PAUSE;
}
| True if c is ISO-LATIN characters 0-9, *, # , +, WILD, WAIT, PAUSE |
public static void preloadDataModel(){
getMapOfLanguagesById();
getListOfCustomColumnTypes();
getMapOfEBookFilesByBookId();
getMapOfAuthorsByBookId();
getMapOfTagsByBookId();
getMapOfSeriesByBookId();
getMapOfCommentsByBookId();
getListOfTags();
getListOfAuthors();
getListOfSeries();
getListOfBooks();
getMapOfBooks();
getMapOfTags();
getMapOfAuthors();
getMapOfSeries();
generateImplicitLanguageTags();
getMapOfBooksByTag();
getMapOfBooksByAuthor();
getMapOfBooksBySeries();
getMapOfBooksByRating();
}
| The following loads up data in a number of different views to help with more efficient access to it later in the run. Some values that are optional are only loaded on demand when an attempt is amde to access their data set. |
protected void prepareDocument(Document doc){
removeScriptsAndStyles(doc);
}
| Prepares document. Currently only stipping unlikely candidates, since from time to time they're getting more score than good ones especially in cases when major text is short. |
public ChannelFuture bind(SocketAddress address){
return bootstrap.bind(address);
}
| Bind the server on the specified address. |
public String invertSelectionTipText(){
return "Set attribute selection mode. If false, only selected" + " (numeric) attributes in the range will be discretized; if" + " true, only non-selected attributes will be discretized.";
}
| Returns the tip text for this property |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
protected void clearRequestBody(){
LOG.trace("enter EntityEnclosingMethod.clearRequestBody()");
requestStream=null;
requestString=null;
requestEntity=null;
}
| Clears the request body. <p> This method must be overridden by sub-classes that implement alternative request content input methods. </p> |
public byte[] toByteArray(){
int size=24 + 2 * interfaceCount;
if (fields != null) {
size+=fields.length;
}
int nbMethods=0;
CodeWriter cb=firstMethod;
while (cb != null) {
++nbMethods;
size+=cb.getSize();
cb=cb.next;
}
size+=pool.length;
int attributeCount=0;
if (sourceFile != null) {
++attributeCount;
size+=8;
}
if ((access & Constants.ACC_DEPRECATED) != 0) {
++attributeCount;
size+=6;
}
if (innerClasses != null) {
++attributeCount;
size+=8 + innerClasses.length;
}
ByteVector out=new ByteVector(size);
out.put4(0xCAFEBABE).put2(3).put2(45);
out.put2(index).putByteArray(pool.data,0,pool.length);
out.put2(access).put2(name).put2(superName);
out.put2(interfaceCount);
for (int i=0; i < interfaceCount; ++i) {
out.put2(interfaces[i]);
}
out.put2(fieldCount);
if (fields != null) {
out.putByteArray(fields.data,0,fields.length);
}
out.put2(nbMethods);
cb=firstMethod;
while (cb != null) {
cb.put(out);
cb=cb.next;
}
out.put2(attributeCount);
if (sourceFile != null) {
out.put2(newUTF8("SourceFile").index).put4(2).put2(sourceFile.index);
}
if ((access & Constants.ACC_DEPRECATED) != 0) {
out.put2(newUTF8("Deprecated").index).put4(0);
}
if (innerClasses != null) {
out.put2(newUTF8("InnerClasses").index);
out.put4(innerClasses.length + 2).put2(innerClassesCount);
out.putByteArray(innerClasses.data,0,innerClasses.length);
}
return out.data;
}
| Returns the bytecode of the class that was build with this class writer. |
public void dumpOptions(){
logger.info("");
for ( Method getter : GetConfigurationInterface.class.getMethods()) {
String getterName=getter.getName();
try {
Object result=getter.invoke(ConfigurationManager.getCurrentProfile());
if (result instanceof Boolean) {
result=LocalizationHelper.getYesOrNo((Boolean)result);
}
if (result instanceof List) {
for (int i=0; i < ((List)result).size(); i++) {
assert ((List)result).get(i) instanceof CustomCatalogEntry;
CustomCatalogEntry c=((List<CustomCatalogEntry>)result).get(i);
String OptionName=Helper.pad(Localization.Main.getText("gui.tab6.label") + " [" + (i + 1)+ "], "+ c.getAtTop().toString(),' ',50) + " : ";
logger.info(OptionName + c.getLabel() + " ("+ c.getValue().toString()+ "), "+ c.getAtTop().toString());
}
}
else {
String optionName=getterName.substring(3);
dumpOption(optionName,result);
}
}
catch ( IllegalAccessException e) {
logger.warn("",e);
}
catch ( InvocationTargetException e) {
logger.warn("",e);
}
}
logger.info("");
}
| Dump all the configuration options listed as get methods in the configuration interface. |
@Override public void rescan(){
restart();
}
| Invokes restart method since FlingSDK doesn't have analog of rescan |
private void updateYFieldValue(){
if (mousePosition != null) {
Rectangle2D plotArea=engine.getChartPanel().getScreenDataArea();
if (engine.getChartPanel().getChart().getPlot() instanceof XYPlot) {
XYPlot plot=(XYPlot)engine.getChartPanel().getChart().getPlot();
for (int i=0; i < plot.getRangeAxisCount(); i++) {
ValueAxis config=plot.getRangeAxis(i);
if (config != null && config.getLabel() != null) {
if (config.getLabel().equals(String.valueOf(rangeAxisSelectionCombobox.getSelectedItem()))) {
double chartY=config.java2DToValue(mousePosition.getY(),plotArea,plot.getRangeAxisEdge());
yField.setText(String.valueOf(chartY));
}
}
}
}
}
}
| Updates the preselected y-value. |
public ServerProxy(InternalPool pool){
this.pool=pool;
}
| Creates a server proxy for the given pool. |
public static Bitmap drawableToBitmap(Drawable drawable){
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable)drawable).getBitmap();
}
else {
Bitmap bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888);
Canvas canvas=new Canvas(bitmap);
drawable.setBounds(0,0,canvas.getWidth(),canvas.getHeight());
drawable.draw(canvas);
return bitmap;
}
}
| Converts a drawable to a bitmap. |
public boolean isDescription(){
Object oo=get_Value(COLUMNNAME_IsDescription);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Description Only. |
public static Integer toInteger(int val){
if (val >= 0 && val < cachedInts.length) return (cachedInts[val]);
return new Integer(val);
}
| Converts an int into a possibly cached Integer. |
public boolean hasName(){
return getName() != null;
}
| Returns whether it has the step's name. |
protected void appendContentEnd(StringBuffer buffer){
buffer.append(contentEnd);
}
| <p>Append to the <code>toString</code> the content end.</p> |
public static SubscriptionStillActiveException convertToApi(org.oscm.internal.types.exception.SubscriptionStillActiveException oldEx){
return convertExceptionToApi(oldEx,SubscriptionStillActiveException.class);
}
| Convert source version Exception to target version Exception |
public void drawTile(VPFGraphicWarehouse warehouse,double dpplat,double dpplon,LatLonPoint ll1,LatLonPoint ll2){
try {
for (List<Object> area=new ArrayList<Object>(getColumnCount()); parseRow(area); ) {
warehouse.createArea(covtable,this,area,ll1,ll2,dpplat,dpplon);
}
}
catch ( FormatException f) {
System.out.println("Exception: " + f.getClass() + " "+ f.getMessage());
}
}
| Parse the area records for this tile, calling warehouse.createArea once for each record. |
public void schedule(TimerTask task,long delay){
if (delay < 0) {
throw new IllegalArgumentException("delay < 0: " + delay);
}
scheduleImpl(task,delay,-1,false);
}
| Schedule a task for single execution after a specified delay. |
@Override public String globalInfo(){
return "Multi-Target Version of BaggingML\n" + "It takes votes using the confidence outputs of the base classifier.";
}
| Description to display in the GUI. |
public boolean isMissingAt(int rowIndex,int columnIndex){
return ((DataTableModel)getModel()).isMissingAt(mIndices[rowIndex],columnIndex);
}
| checks whether the value at the given position is missing |
public final void run(final Population population,final ReplanningContext replanningContext){
beforePopulationRunHook(population,replanningContext);
delegate.run(population.getPersons().values(),population.getPersonAttributes(),replanningContext);
afterRunHook(population);
}
| Randomly chooses for each person of the population a strategy and uses that strategy on the person. |
@Override public void execute() throws BuildException {
Java7Checker.check();
ModuleDescriptorReader reader;
try {
CeylonClassLoader loader=Util.getCeylonClassLoaderCachedInProject(getProject());
try {
reader=new ModuleDescriptorReader(loader,module.getName(),getSrc());
}
catch ( NoSuchModuleException e) {
throw new BuildException("Failed to load module",e);
}
}
catch ( ClassLoaderSetupException x) {
throw new BuildException("Failed to set up Ceylon class loader",x);
}
if (versionProperty != null) {
setProjectProperty(versionProperty,reader.getModuleVersion());
}
if (nameProperty != null) {
setProjectProperty(nameProperty,reader.getModuleName());
}
if (licenseProperty != null) {
setProjectProperty(licenseProperty,reader.getModuleLicense());
}
}
| Executes the task. |
public static int value(String s){
return services.getValue(s);
}
| Converts a textual representation of a TCP/UDP service into its port number. Integers in the range 0..65535 are also accepted. |
public SimpleOrderedMap(){
super();
}
| Creates an empty instance |
protected int engineGetBlockSize(){
return DESConstants.DES_BLOCK_SIZE;
}
| Returns the block size (in bytes). |
public boolean isCommited(){
return commited;
}
| Retrieve true if the transaction ends with a commit |
public com.linkedin.camus.example.records.DummyLog.Builder clearMuchoStuff(){
muchoStuff=null;
fieldSetFlags()[2]=false;
return this;
}
| Clears the value of the 'muchoStuff' field |
public static String hashData(final String data) throws CryptoException {
try {
final MessageDigest md=MessageDigest.getInstance("SHA-256","BC");
md.update(data.getBytes("UTF-8"));
return new BigInteger(md.digest()).toString(16);
}
catch ( final Exception e) {
throw new CryptoException(e.getMessage(),e);
}
}
| get hash value for given String |
@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:48.323 -0500",hash_original_method="41EBA2EAF373C2E18FF1DC39DB5B0A24",hash_generated_method="4BC37B5677B6027DE42CCB7478AA9851") public void startElement(String qName,AttributeList qAtts) throws SAXException {
ArrayList<SAXParseException> exceptions=null;
if (!namespaces) {
if (contentHandler != null) {
attAdapter.setAttributeList(qAtts);
contentHandler.startElement("","",qName.intern(),attAdapter);
}
return;
}
nsSupport.pushContext();
int length=qAtts.getLength();
for (int i=0; i < length; i++) {
String attQName=qAtts.getName(i);
if (!attQName.startsWith("xmlns")) continue;
String prefix;
int n=attQName.indexOf(':');
if (n == -1 && attQName.length() == 5) {
prefix="";
}
else if (n != 5) {
continue;
}
else prefix=attQName.substring(n + 1);
String value=qAtts.getValue(i);
if (!nsSupport.declarePrefix(prefix,value)) {
reportError("Illegal Namespace prefix: " + prefix);
continue;
}
if (contentHandler != null) contentHandler.startPrefixMapping(prefix,value);
}
atts.clear();
for (int i=0; i < length; i++) {
String attQName=qAtts.getName(i);
String type=qAtts.getType(i);
String value=qAtts.getValue(i);
if (attQName.startsWith("xmlns")) {
String prefix;
int n=attQName.indexOf(':');
if (n == -1 && attQName.length() == 5) {
prefix="";
}
else if (n != 5) {
prefix=null;
}
else {
prefix=attQName.substring(6);
}
if (prefix != null) {
if (prefixes) {
if (uris) atts.addAttribute(nsSupport.XMLNS,prefix,attQName.intern(),type,value);
else atts.addAttribute("","",attQName.intern(),type,value);
}
continue;
}
}
try {
String attName[]=processName(attQName,true,true);
atts.addAttribute(attName[0],attName[1],attName[2],type,value);
}
catch ( SAXException e) {
if (exceptions == null) {
exceptions=new ArrayList<SAXParseException>();
}
exceptions.add((SAXParseException)e);
atts.addAttribute("",attQName,attQName,type,value);
}
}
if (exceptions != null && errorHandler != null) {
for ( SAXParseException ex : exceptions) {
errorHandler.error(ex);
}
}
if (contentHandler != null) {
String name[]=processName(qName,false,false);
contentHandler.startElement(name[0],name[1],name[2],atts);
}
}
| Adapter implementation method; do not call. Adapt a SAX1 startElement event. <p>If necessary, perform Namespace processing.</p> |
public Remote create(BenchServer.RemoteObjectFactory factory) throws RemoteException {
Remote impl=factory.create();
implTable.put(RemoteObject.toStub(impl),new WeakReference(impl));
return impl;
}
| Uses the given remote object factory to create a new remote object on the server side. |
public static void runtimeAssert(boolean condition,String message){
if (REPLACEMENTS_ASSERTIONS_ENABLED) {
AssertionNode.assertion(false,condition,message);
}
}
| Asserts that condition evaluates to true at runtime. This is intended to be used within snippets or stubs, and will lead to a VM error if it fails. |
private static ViewDocument loadViewDocument(IFile viewFile) throws IOException {
ObjectXmlPersist persist=new ObjectXmlPersist(XStreamFactory.getSharedRefXStream());
return (ViewDocument)persist.load(viewFile.getRawLocationURI());
}
| Load a view document from a file. |
@Override public void acceptTrainingSet(TrainingSetEvent e){
Instances trainingSet=e.getTrainingSet();
DataSetEvent dse=new DataSetEvent(this,trainingSet);
acceptDataSet(dse);
}
| Accept a training set |
public T caseS_Var(S_Var object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>SVar</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
public void showPopup(){
if (popup == null && entryList.getModel().getSize() > 0) {
if (isShowing()) {
Point origin=getLocationOnScreen();
PopupFactory pf=PopupFactory.getSharedInstance();
Component parent=this;
if (OSUtils.isMacOSX()) {
parent=new JPanel();
new MyPopup(this,parent,0,0);
}
popup=pf.getPopup(parent,getPopupComponent(),origin.x,origin.y + getHeight() + 1);
showPending=false;
popup.show();
}
else {
showPending=true;
}
}
}
| Shows the popup. |
private void updateTableVisibility(){
if (extrasTable.getRowCount() > 0) {
if (!extrasRootLayout.isVisible()) {
extrasRootLayout.setVisible(true);
extrasRootLayout.getParent().invalidate();
extrasRootLayout.getParent().validate();
extrasRootLayout.getParent().repaint();
}
}
else {
if (extrasRootLayout.isVisible()) {
extrasRootLayout.setVisible(false);
extrasRootLayout.getParent().invalidate();
extrasRootLayout.getParent().validate();
extrasRootLayout.getParent().repaint();
}
}
}
| Hides table if it does not have any rows. Shows otherwise |
boolean hasNextSFeature(){
return (sFeatureIdx < sFeatures.size());
}
| Checks for next s feature. |
public String globalInfo(){
return "Outputs the predictions in HTML.";
}
| Returns a string describing the output generator. |
@SuppressWarnings("unchecked") @Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case UmplePackage.ANONYMOUS_MORE_GUARDS_1__CODE_LANG_1:
getCodeLang_1().clear();
getCodeLang_1().addAll((Collection<? extends CodeLang_>)newValue);
return;
case UmplePackage.ANONYMOUS_MORE_GUARDS_1__CODE_LANGS_1:
getCodeLangs_1().clear();
getCodeLangs_1().addAll((Collection<? extends CodeLangs_>)newValue);
return;
}
super.eSet(featureID,newValue);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public boolean isEmpty(){
return filteredClasses == null || filteredClasses.isEmpty();
}
| Returns whether no classes are filtered. |
protected void append(Node newNode) throws org.xml.sax.SAXException {
Node currentNode=m_currentNode;
if (null != currentNode) {
currentNode.appendChild(newNode);
}
else if (null != m_docFrag) {
m_docFrag.appendChild(newNode);
}
else {
boolean ok=true;
short type=newNode.getNodeType();
if (type == Node.TEXT_NODE) {
String data=newNode.getNodeValue();
if ((null != data) && (data.trim().length() > 0)) {
throw new org.xml.sax.SAXException("Warning: can't output text before document element! Ignoring...");
}
ok=false;
}
else if (type == Node.ELEMENT_NODE) {
if (m_doc.getDocumentElement() != null) {
throw new org.xml.sax.SAXException("Can't have more than one root on a DOM!");
}
}
if (ok) m_doc.appendChild(newNode);
}
}
| Append a node to the current container. |
@SuppressWarnings("UnusedDeclaration") public Drawable createDrawable(int color,Rect bounds){
Drawable drawable=new GradientDrawable(Orientation.BOTTOM_TOP,new int[]{color,color}).mutate();
if (color == Color.TRANSPARENT) {
drawable.setAlpha(0);
}
drawable.setBounds(bounds);
return drawable;
}
| Creates a new drawable (implementation of the Drawable object may vary depending on OS version).<br> Drawable will be colored with given color, and clipped to match given boundaries. |
public DoubleListParameter(OptionID optionID,boolean optional){
super(optionID,optional);
}
| Constructs a list parameter with the given optionID and optional flag. |
private void releaseIO(){
if (mBufferedReader != null) {
try {
mBufferedReader.close();
}
catch ( IOException e) {
e.printStackTrace();
}
mBufferedReader=null;
}
}
| release reader IO |
public static boolean isTransient(int mod){
return (mod & TRANSIENT) != 0;
}
| Returns true if the modifiers include the <tt>transient</tt> modifier. |
public static GenericSqliteHelper openCopy(String dbFile){
File fs=new File(dbFile);
dbFile=fs.getAbsolutePath();
if (!(Path.unprotect(dbFile,4,false) && fs.exists() && fs.canRead())) {
if (Cfg.DEBUG) {
Check.log(TAG + " (openCopy) ERROR: no suitable db file");
}
return null;
}
String localFile=Path.markup() + fs.getName();
try {
Utils.copy(new File(dbFile),new File(localFile));
}
catch ( IOException e) {
return null;
}
return new GenericSqliteHelper(localFile,true);
}
| Copy the db in a temp directory and opens it |
public static Complex multiply(Complex sample1,Complex sample2){
float inphase=multiplyInphase(sample1.inphase(),sample1.quadrature(),sample2.inphase(),sample2.quadrature());
float quadrature=multiplyQuadrature(sample1.inphase(),sample1.quadrature(),sample2.inphase(),sample2.quadrature());
return new Complex(inphase,quadrature);
}
| Multiplies both samples returning a new sample with the results |
public static String clean(String str){
return (str == null ? "" : str.trim());
}
| <p> Removes control characters, including whitespace, from both ends of this String, handling <code>null</code> by returning an empty String. </p> |
@SuppressWarnings("rawtypes") private static void unpack(String jarFile,File destDir) throws IOException {
byte[] buffer=new byte[1024 * 1024];
int length;
destDir.mkdirs();
JarFile jar=new JarFile(jarFile);
Enumeration enumeration=jar.entries();
while (enumeration.hasMoreElements()) {
InputStream is=null;
FileOutputStream os=null;
JarEntry jarEntry=(JarEntry)enumeration.nextElement();
File destFile=new File(destDir,jarEntry.getName());
if (jarEntry.isDirectory()) {
destFile.mkdirs();
continue;
}
else if (!destFile.getParentFile().isDirectory()) {
destFile.getParentFile().mkdirs();
}
try {
is=jar.getInputStream(jarEntry);
os=new FileOutputStream(destFile);
while ((length=is.read(buffer)) >= 0) {
os.write(buffer,0,length);
}
}
finally {
if (os != null) {
os.close();
}
if (is != null) {
is.close();
}
}
}
}
| Unpacks a jar. |
public VobSubSubtitleHandler(sage.VideoFrame vf,sage.media.format.ContainerFormat inFormat){
super(inFormat);
this.vf=vf;
}
| Creates a new instance of VobSubSubtitleHandler |
public float angle(){
return (float)Math.atan2(y(),x());
}
| Angle of this sample in radians |
public SorensonVideo(){
this.reset();
}
| Constructs a new SorensonVideo. |
public static String isContinuousCopiesVpool(VirtualPool vpool,DbClient dbClient){
StringBuilder virtualPoolNameBuilder=new StringBuilder();
URIQueryResultList virtualPoolURIs=new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVirtualPoolByMirrorVpool(vpool.getId().toString()),virtualPoolURIs);
for ( URI uri : virtualPoolURIs) {
VirtualPool virtualPool=dbClient.queryObject(VirtualPool.class,uri);
if (virtualPool != null && !virtualPool.getInactive()) {
if (virtualPoolNameBuilder.length() == 0) {
virtualPoolNameBuilder.append(virtualPool.getLabel());
}
else {
virtualPoolNameBuilder.append(", ").append(virtualPool.getLabel());
}
}
}
return virtualPoolNameBuilder.toString();
}
| This method checks if the passed vpool is set as the continuous copies vpool for any of the vpool. If yes returns virtual pool names where it is used as continuous copies vpool. |
public SubjectInfoAccessExtension(Boolean critical,Object value) throws IOException {
this.extensionId=PKIXExtensions.SubjectInfoAccess_Id;
this.critical=critical.booleanValue();
if (!(value instanceof byte[])) {
throw new IOException("Illegal argument type");
}
extensionValue=(byte[])value;
DerValue val=new DerValue(extensionValue);
if (val.tag != DerValue.tag_Sequence) {
throw new IOException("Invalid encoding for " + "SubjectInfoAccessExtension.");
}
accessDescriptions=new ArrayList<AccessDescription>();
while (val.data.available() != 0) {
DerValue seq=val.data.getDerValue();
AccessDescription accessDescription=new AccessDescription(seq);
accessDescriptions.add(accessDescription);
}
}
| Create the extension from the passed DER encoded value of the same. |
public boolean show_lib_meths(){
return soot.PhaseOptions.getBoolean(options,"show-lib-meths");
}
| Show Library Methods -- . |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:47.812 -0500",hash_original_method="1ABAE35BE3091AD40FC1FECAC80B863E",hash_generated_method="C52168ADADDB15DD7003C2A37BAF0E3A") public void endDocument() throws SAXException {
if (documentHandler != null) documentHandler.endDocument();
}
| End document event. |
void replacePolicyList(JList policyList){
JList list=(JList)getComponent(MW_POLICY_LIST);
list.setModel(policyList.getModel());
}
| Replace the policy_entry_list TEXTAREA component in the PolicyTool window with an updated one. |
public SimpleConstant(String name,double doubleValue,String annotation,boolean invisible){
this(name,doubleValue,annotation);
this.invisible=invisible;
}
| Creates a Constant with the given characteristics. |
public String createShare(IsilonSMBShare smbFileShare,String zoneName) throws IsilonException {
String baseUrl=getURIWithZoneName(_baseUrl.resolve(URI_SMB_SHARES).toString(),zoneName);
URI uri=URI.create(baseUrl);
return create(uri,"share",smbFileShare);
}
| Create Isilon SMB share on access zone. |
public synchronized void remove(ComponentName componentName,UserHandleCompat user){
mCache.remove(new ComponentKey(componentName,user));
}
| Remove any records for the supplied ComponentName. |
public static int floorLog2(double d){
if (d <= 0) throw new ArithmeticException("Negative number or zero");
long bits=Double.doubleToLongBits(d);
int exp=((int)(bits >> 52)) & 0x7FF;
if (exp == 0x7FF) throw new ArithmeticException("Infinity or NaN");
if (exp == 0) return floorLog2(d * 18014398509481984L) - 54;
return exp - 1023;
}
| Returns the largest power of 2 that is less than or equal to the the specified positive value. |
public void testEquals(){
byte[] key=new byte[]{1,2,3,4,5};
String algorithm="Algorithm";
SecretKeySpec ks1=new SecretKeySpec(key,algorithm);
SecretKeySpec ks2=new SecretKeySpec(key,algorithm);
SecretKeySpec ks3=new SecretKeySpec(key,algorithm);
assertTrue("The equivalence relation should be reflexive.",ks1.equals(ks1));
assertTrue("Objects built on the same parameters should be equal.",ks1.equals(ks2));
assertTrue("The equivalence relation should be symmetric.",ks2.equals(ks1));
assertTrue("Objects built on the equal parameters should be equal.",ks2.equals(ks3));
assertTrue("The equivalence relation should be transitive.",ks1.equals(ks3));
assertFalse("Should not be equal to null object.",ks1.equals(null));
ks2=new SecretKeySpec(new byte[]{1},algorithm);
assertFalse("Objects should not be equal.",ks1.equals(ks2));
ks2=new SecretKeySpec(key,"Another Algorithm");
assertFalse("Objects should not be equal.",ks1.equals(ks2));
}
| equals(Object obj) method testing. Tests the correctness of equal operation: it should be reflexive, symmetric, transitive, consistent and should be false on null object. |
public static ServerSocketBar openJNI(int fd,int port) throws IOException {
return currentFactory().open(fd,port);
}
| Creates the SSL ServerSocket. |
public final void doubleScaleTransformShear(){
scale(this.Trm1);
if (clip != null) {
final Area final_clip=(Area)clip.clone();
final Area unscaled_clip=getUnscaledClip((Area)clip.clone());
final int segCount=isRectangle(final_clip);
clipImage(unscaled_clip,final_clip,segCount);
i_x=(int)clip.getBounds2D().getMinX();
i_y=(int)clip.getBounds2D().getMinY();
i_w=(int)((clip.getBounds2D().getMaxX()) - i_x);
i_h=(int)((clip.getBounds2D().getMaxY()) - i_y);
}
else if (current_image.getType() == 10) {
}
else {
current_image=ColorSpaceConvertor.convertToARGB(current_image);
}
}
| applies the shear/rotate of a double transformation to the clipped image |
public static String formatNumber(double value){
logger.debug("----------Input value : " + value);
return String.format("%.2f",value);
}
| Format input number using the format string "%.2f" |
public String buildUnionQuery(String[] subQueries,String sortOrder,String limit){
StringBuilder query=new StringBuilder(128);
int subQueryCount=subQueries.length;
String unionOperator=mDistinct ? " UNION " : " UNION ALL ";
for (int i=0; i < subQueryCount; i++) {
if (i > 0) {
query.append(unionOperator);
}
query.append(subQueries[i]);
}
appendClause(query," ORDER BY ",sortOrder);
appendClause(query," LIMIT ",limit);
return query.toString();
}
| Given a set of subqueries, all of which are SELECT statements, construct a query that returns the union of what those subqueries return. |
public void query(String query){
}
| Filters the DbfTableModel given a SQL like string |
public VolumeLists(){
_volumeListsImpl=new VolumeListsImpl();
}
| Construye un objeto de la clase. |
final public void shake(Collection<PointMatch> matches,float scale,float[] center){
double xd=0.0;
double yd=0.0;
double rd=0.0;
int num_matches=matches.size();
if (num_matches > 0) {
for ( PointMatch m : matches) {
float[] m_p1=m.getP1().getW();
float[] m_p2=m.getP2().getW();
xd+=Math.abs(m_p1[0] - m_p2[0]);
;
yd+=Math.abs(m_p1[1] - m_p2[1]);
;
float x1=m_p1[0] - center[0];
float y1=m_p1[1] - center[1];
float x2=m_p2[0] - center[0];
float y2=m_p2[1] - center[1];
float l1=(float)Math.sqrt(x1 * x1 + y1 * y1);
float l2=(float)Math.sqrt(x2 * x2 + y2 * y2);
x1/=l1;
x2/=l2;
y1/=l1;
y2/=l2;
float cos=x1 * x2 + y1 * y2;
float sin=y1 * x2 - x1 * y2;
rd+=Math.abs(Math.atan2(sin,cos));
}
xd/=matches.size();
yd/=matches.size();
rd/=matches.size();
}
affine.rotate(rnd.nextGaussian() * (float)rd * scale,center[0],center[1]);
}
| change the model a bit <p/> estimates the necessary amount of shaking for each single dimensional distance in the set of matches |
public int hashCode(){
return (int)(this.lat * 1000) + (int)(this.lon * 1000) + (this.geom != null ? this.geom.hashCode() : 0)+ (this.id != null ? this.id.hashCode() : 0)+ this.properties.hashCode();
}
| Hash the relevant features of this PointFeature for efficient use in HashSets, etc. PointFeatures are put in HashSets in the conveyal/otpa-cluster project. |
public void addQueryExecuteListener(QueryExecuteListener l){
m_QueryExecuteListeners.add(l);
}
| adds the given listener to the list of listeners. |
public TridiagonalDoubleMatrix2D(double[][] values){
this(values.length,values.length == 0 ? 0 : values[0].length);
assign(values);
}
| Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form <tt>values[row][column]</tt> and have exactly the same number of columns in every row. <p> The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. |
public static XMethod createXMethod(String className,Method method){
String methodName=method.getName();
String methodSig=method.getSignature();
int accessFlags=method.getAccessFlags();
return createXMethod(className,methodName,methodSig,accessFlags);
}
| Create an XMethod object from a BCEL Method. |
String readLiteral(String source,int ofs,String token){
return source.substring(ofs,ofs + token.length());
}
| Read an unparsable text string. |
public ManhattanDistance(){
super();
}
| Constructs an Manhattan Distance object, Instances must be still set. |
public void resetShipBeforeDateIfAfter(Timestamp newShipBeforeDate){
if (newShipBeforeDate != null) {
if ((this.shipBeforeDate == null) || (!this.shipBeforeDate.before(newShipBeforeDate))) {
this.shipBeforeDate=newShipBeforeDate;
}
}
}
| Reset the ship group's shipBeforeDate if it is after the parameter |
public static void main(String a[]) throws Throwable {
final String main="LowMemoryTest$TestMain";
RunUtil.runTestKeepGcOpts(main);
RunUtil.runTestClearGcOpts(main,"-XX:+UseSerialGC");
RunUtil.runTestClearGcOpts(main,"-XX:+UseParallelGC");
RunUtil.runTestClearGcOpts(main,"-XX:+UseG1GC");
RunUtil.runTestClearGcOpts(main,"-XX:+UseConcMarkSweepGC");
}
| Run the test multiple times with different GC versions. First with default command line specified by the framework. Then with GC versions specified by the test. |
public PcRunner(DataWrapper dataWrapper,Parameters params){
super(dataWrapper,params,null);
}
| Constructs a wrapper for the given DataWrapper. The DataWrapper must contain a DataSet that is either a DataSet or a DataSet or a DataList containing either a DataSet or a DataSet as its selected model. |
protected MultipleDownloadsCompletedReceiver registerNewMultipleDownloadsReceiver(){
MultipleDownloadsCompletedReceiver receiver=new MultipleDownloadsCompletedReceiver();
mContext.registerReceiver(receiver,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
return receiver;
}
| Helper to create and register a new MultipleDownloadCompletedReciever This is used to track many simultaneous downloads by keeping count of all the downloads that have completed. |
@Override public void apply(IDocument document,ConfigurableCompletionProposal proposal) throws BadLocationException {
final String syntacticReplacementString=proposal.getReplacementString();
{
String actualSyntacticReplacementString=getActualReplacementString(proposal);
if (!syntacticReplacementString.equals(actualSyntacticReplacementString)) {
QualifiedName shortQualifiedName=applyValueConverter(actualSyntacticReplacementString);
if (shortQualifiedName.getSegmentCount() == 1) {
simpleApply(document,actualSyntacticReplacementString,proposal);
return;
}
}
}
final QualifiedName qualifiedName=(QualifiedName)proposal.getAdditionalData(KEY_QUALIFIED_NAME);
if (qualifiedName == null) {
super.apply(document,proposal);
return;
}
if (qualifiedName.getSegmentCount() == 1) {
simpleApply(document,syntacticReplacementString,proposal);
return;
}
if (qualifiedName.getSegmentCount() == 2 && N4TSQualifiedNameProvider.GLOBAL_NAMESPACE_SEGMENT.equals(qualifiedName.getFirstSegment())) {
simpleApply(document,syntacticReplacementString,proposal);
return;
}
String alias=null;
boolean isDefaultImport=isDefaultExport(qualifiedName);
String shortQName=lastSegmentOrDefaultHost(qualifiedName);
IEObjectDescription descriptionFullQN=scope.getSingleElement(QualifiedName.create(shortQName));
if (descriptionFullQN instanceof PlainAccessOfNamespacedImportDescription && !isDefaultImport) {
simpleApply(document,((PlainAccessOfNamespacedImportDescription)descriptionFullQN).getNamespacedName(),proposal);
return;
}
if (descriptionFullQN != null) {
IEObjectDescription description=scope.getSingleElement(qualifiedName);
IEObjectDescription existingAliased=findApplicableDescription(description.getEObjectOrProxy(),qualifiedName,false);
if (existingAliased != null) {
simpleApply(document,syntacticReplacementString,proposal);
return;
}
alias="Alias" + shortQName;
}
applyWithImport(qualifiedName,alias,document,proposal);
}
| Modify the document and start linked editing if necessary. Imports will be added if necessary. |
private static McfData executeInteractionQuery(Analytics analytics,String tableId) throws IOException {
return analytics.data().mcf().get(tableId,"2012-01-01","2012-03-31","mcf:totalConversions").setDimensions("mcf:source").setSort("-mcf:totalConversions").setFilters("mcf:medium==organic").setMaxResults(25).execute();
}
| Returns the top 25 organic sources with most total conversions. The MCF API is used to retrieve this data. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:36.559 -0500",hash_original_method="298BCAB11064A058FB155FBEF5B04212",hash_generated_method="85399CA52B5D349444155F5AF171013D") public boolean isFinalResponse(){
return isFinalResponse(statusLine.getStatusCode());
}
| Is this a final response? |
private boolean downloadSuccessful(long enqueue){
Query query=new Query();
query.setFilterById(enqueue);
Cursor c=mDownloadManager.query(query);
if (c.moveToFirst()) {
int columnIndex=c.getColumnIndex(DownloadManager.COLUMN_STATUS);
if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) {
Log.v(LOG_TAG,"Successfully downloaded file!");
return true;
}
}
return false;
}
| Determines if a given download was successful by querying the DownloadManager. |
public void reset(){
for (int i=0; i < buf.length; i++) {
buf[i]=0;
}
bufOff=0;
cipher.reset();
}
| Reset the mac generator. |
public StringBuffer insert(int index,boolean b){
return insert(index,b ? "true" : "false");
}
| Inserts the string representation of the specified boolean into this buffer at the specified offset. |
protected void prepareNewBatch(String stmt) throws SQLException {
throw new UnsupportedOperationException("Attempt to add to non-existent batch");
}
| Prepare for a new SQL batch. |
public void addRenderingHints(Map hints){
this.hints.putAll(hints);
}
| Sets the values of an arbitrary number of preferences for the rendering algorithms. Only values for the rendering hints that are present in the specified <code>Map</code> object are modified. All other preferences not present in the specified object are left unmodified. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the <code>RenderingHints</code> class for definitions of some common keys and values. |
public static <T>void execute(final String pluginName,final IPluginRegistry<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>> pluginRegistry){
for ( final com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T> plugin : pluginRegistry) {
if ((plugin instanceof IBatchPlugin) && plugin.getName().equals(pluginName)) {
try {
((IBatchPlugin)plugin).run();
}
catch ( final Exception exception) {
CUtilityFunctions.logException(exception);
return;
}
}
}
}
| Executes a batch plugin. This can be used to start BinNavi in batch mode and just execute a plugin. |
public static void write(float lt,float ln,int offset_x1,int offset_y1,Image image,int image_width,int image_height,LinkProperties properties,DataOutputStream dos) throws IOException, InterruptedException {
int[] pixels=new int[image_width * image_height];
PixelGrabber pixelgrabber=new PixelGrabber(image,0,0,image_width,image_height,pixels,0,image_width);
pixelgrabber.grabPixels();
LinkRaster.write(lt,ln,offset_x1,offset_y1,image_width,image_height,pixels,properties,dos);
}
| Write an image, Lat/Lon with X/Y placement with an ImageIcon. |
boolean isMenu(){
return menu;
}
| Indicates that this is a menu preventing getCurrent() from ever returning this class |
protected void calculateStatesStatesPruning(int[] states1,double[] matrices1,int[] states2,double[] matrices2,double[] partials3,int[] matrixMap){
throw new RuntimeException("calculateStatesStatesPruning not implemented using matrixMap");
}
| Calculates partial likelihoods at a node when both children have states. |
private EmrClusterDefinitionInformation createEmrClusterDefinitionFromEntity(EmrClusterDefinitionEntity emrClusterDefinitionEntity) throws Exception {
EmrClusterDefinition emrClusterDefinition=xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class,emrClusterDefinitionEntity.getConfiguration());
EmrClusterDefinitionInformation emrClusterDefinitionInformation=new EmrClusterDefinitionInformation();
emrClusterDefinitionInformation.setId(emrClusterDefinitionEntity.getId());
emrClusterDefinitionInformation.setEmrClusterDefinitionKey(new EmrClusterDefinitionKey(emrClusterDefinitionEntity.getNamespace().getCode(),emrClusterDefinitionEntity.getName()));
emrClusterDefinitionInformation.setEmrClusterDefinition(emrClusterDefinition);
return emrClusterDefinitionInformation;
}
| Creates the EMR cluster definition information from the persisted entity. |
private <T>String generateTestFile(String filename,List<T> elems,SyncBehavior syncBehavior,int syncInterval,AvroCoder<T> coder,String codec) throws IOException {
Random random=new Random(0);
File tmpFile=tmpFolder.newFile(filename);
String path=tmpFile.toString();
FileOutputStream os=new FileOutputStream(tmpFile);
DatumWriter<T> datumWriter=coder.createDatumWriter();
try (DataFileWriter<T> writer=new DataFileWriter<>(datumWriter)){
writer.setCodec(CodecFactory.fromString(codec));
writer.create(coder.getSchema(),os);
int recordIndex=0;
int syncIndex=syncBehavior == SyncBehavior.SYNC_RANDOM ? random.nextInt(syncInterval) : 0;
for ( T elem : elems) {
writer.append(elem);
recordIndex++;
switch (syncBehavior) {
case SYNC_REGULAR:
if (recordIndex == syncInterval) {
recordIndex=0;
writer.sync();
}
break;
case SYNC_RANDOM:
if (recordIndex == syncIndex) {
recordIndex=0;
writer.sync();
syncIndex=random.nextInt(syncInterval);
}
break;
case SYNC_DEFAULT:
default :
}
}
}
return path;
}
| Generates an input Avro file containing the given records in the temporary directory and returns the full path of the file. |
public CipherParameters generateDerivedParameters(int keySize,int ivSize){
keySize=keySize / 8;
ivSize=ivSize / 8;
byte[] dKey=generateDerivedKey(KEY_MATERIAL,keySize);
byte[] iv=generateDerivedKey(IV_MATERIAL,ivSize);
return new ParametersWithIV(new KeyParameter(dKey,0,keySize),iv,0,ivSize);
}
| Generate a key with initialisation vector parameter derived from the password, salt, and iteration count we are currently initialised with. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.