code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
protected static float convertValuesToSaturate(Element filterElement,BridgeContext ctx){
String s=filterElement.getAttributeNS(null,SVG_VALUES_ATTRIBUTE);
if (s.length() == 0) return 1;
try {
return SVGUtilities.convertSVGNumber(s);
}
catch ( NumberFormatException nfEx) {
throw new BridgeException(ctx,filterElement,nfEx,ERR_ATTRIBUTE_VALUE_MALFORMED,new Object[]{SVG_VALUES_ATTRIBUTE,s});
}
}
| Converts the 'values' attribute of the specified feColorMatrix filter primitive element for the 'saturate' type. |
public SQFPrivateDeclVar(SQFVariable var,SQFPrivatizer privatizer){
this.myElement=var;
this.varName=var.getVarName();
this.privatizer=privatizer;
}
| Create a private declaration variable (variable that is private to the function) with the given string and privatizer |
private static void convertActivityToTranslucentAfterL(Activity activity){
try {
Method getActivityOptions=Activity.class.getDeclaredMethod("getActivityOptions");
getActivityOptions.setAccessible(true);
Object options=getActivityOptions.invoke(activity);
Class<?>[] classes=Activity.class.getDeclaredClasses();
Class<?> translucentConversionListenerClazz=null;
for ( Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
translucentConversionListenerClazz=clazz;
}
}
Method convertToTranslucent=Activity.class.getDeclaredMethod("convertToTranslucent",translucentConversionListenerClazz,ActivityOptions.class);
convertToTranslucent.setAccessible(true);
convertToTranslucent.invoke(activity,null,options);
}
catch ( Throwable t) {
}
}
| Calling the convertToTranslucent method on platforms after Android 5.0 |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:44.778 -0500",hash_original_method="5DFAF4737CD1323AC5BCD66ECC931C62",hash_generated_method="A5059275FC8F144B7A8A5FD136ABE33B") public AttributesImpl atts(){
return theAtts;
}
| Return the attributes as an AttributesImpl object. Returning an AttributesImpl makes the attributes mutable. |
protected void findAndSetTypes(AISViewDefinition view){
FromSubquery fromSubquery=view.getSubquery();
CursorNode cursorNode=new CursorNode();
cursorNode.init("SELECT",fromSubquery.getSubquery(),view.getName().getFullTableName(),fromSubquery.getOrderByList(),fromSubquery.getOffset(),fromSubquery.getFetchFirst(),UpdateMode.UNSPECIFIED,null);
cursorNode.setNodeType(NodeTypes.CURSOR_NODE);
bindAndTransform(cursorNode);
copyExposedNames(fromSubquery.getResultColumns(),fromSubquery.getSubquery().getResultColumns());
fromSubquery.setResultColumns(fromSubquery.getSubquery().getResultColumns());
PlanContext plan=new PlanContext(this);
plan.setPlan(new AST(cursorNode,null));
ASTStatementLoader stmtLoader=new ASTStatementLoader();
stmtLoader.apply(plan);
TypeResolver typeResolver=new TypeResolver();
typeResolver.apply(plan);
copyTypes((ResultSet)((SelectQuery)plan.getPlan()).getInput(),fromSubquery.getResultColumns());
}
| Run just enough rules to get to TypeResolver, then set types. |
public static IntList copy(IntList other,int startIndex,int length,int initialCapacity){
assert initialCapacity >= length : "initialCapacity < length";
int[] array=new int[initialCapacity];
System.arraycopy(other.array,startIndex,array,0,length);
return new IntList(array,length);
}
| Makes a new int list by copying a range from a given int list. |
public Symbol attribIdent(JCTree tree,JCCompilationUnit topLevel){
Env<AttrContext> localEnv=enter.topLevelEnv(topLevel);
localEnv.enclClass=make.ClassDef(make.Modifiers(0),syms.errSymbol.name,null,null,null,null);
localEnv.enclClass.sym=syms.errSymbol;
return tree.accept(identAttributer,localEnv);
}
| Attribute a parsed identifier. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:38.179 -0500",hash_original_method="1A3BA6E0CCE3FB8650C7F390300799F7",hash_generated_method="5BBDF0A418ACAA1B6908C68F12A43E36") public boolean unlinkToDeath(DeathRecipient recipient,int flags){
return true;
}
| Local implementation is a no-op. |
public void testFindProvider() throws IOException {
String id=Long.toString((new Date()).getTime());
Profile p=new Profile(this.getName(),id,new File(this.workspace.toFile(),id));
JmriPreferencesProvider shared=JmriPreferencesProvider.findProvider(p.getPath(),true);
JmriPreferencesProvider privat=JmriPreferencesProvider.findProvider(p.getPath(),false);
assertNotNull(shared);
assertNotNull(privat);
assertNotSame(shared,privat);
FileUtil.delete(p.getPath());
}
| Test of findProvider method, of class JmriPreferencesProvider. |
public boolean hasFetchInterval(){
return fieldSetFlags()[4];
}
| Checks whether the 'fetchInterval' field has been set |
public float put(float key,float value){
float previous=0;
int index=insertionIndex(key);
boolean isNewMapping=true;
if (index < 0) {
index=-index - 1;
previous=_values[index];
isNewMapping=false;
}
byte previousState=_states[index];
_set[index]=key;
_states[index]=FULL;
_values[index]=value;
if (isNewMapping) {
postInsertHook(previousState == FREE);
}
return previous;
}
| Inserts a key/value pair into the map. |
public String toString(){
return "DistanceCapacityInterface " + super.toString();
}
| Returns a string representation of the object. |
public ModelConverter rotate(float rotation,float x,float y,float z,Vec3UV center){
ROTATION_MATRIX.setRotations((float)Math.toRadians(x * rotation),(float)Math.toRadians(y * rotation),(float)Math.toRadians(z * rotation));
for ( Box box : this.modelBoxList) {
for ( Quad quad : box.quads) {
for (int i=0; i < 4; i++) {
Vec3UV vec=quad.vertices[i];
Vec3UV rotatedPoint=null;
rotatedPoint=ROTATION_MATRIX.transformVec(vec,center);
vec.x=rotatedPoint.x;
vec.y=rotatedPoint.y;
vec.z=rotatedPoint.z;
}
}
}
Vec3UV rotatedFwdVec=ROTATION_MATRIX.transformVec(this.fwdVec,center);
this.fwdVec.x=rotatedFwdVec.x;
this.fwdVec.y=rotatedFwdVec.y;
this.fwdVec.z=rotatedFwdVec.z;
Vec3UV rotatedUpVec=ROTATION_MATRIX.transformVec(this.upVec,center);
this.upVec.x=rotatedUpVec.x;
this.upVec.y=rotatedUpVec.y;
this.upVec.z=rotatedUpVec.z;
return this;
}
| Rotates the model vertices. |
private boolean tryDownloadFromPreferredLocation(String file){
String preferredLocationFolder=updateProp.getProperty("location.preferred.folder");
String preferredLocationSuffix=updateProp.getProperty("location.preferred.suffix","");
System.out.println("checking for preferred location: preferredLocationFolder=" + preferredLocationFolder + " preferredLocationSuffix="+ preferredLocationSuffix);
if (preferredLocationFolder == null) {
return false;
}
System.out.println("Downloading " + file + " from preferred location...");
final HttpClient httpClient=new HttpClient(preferredLocationFolder + file + preferredLocationSuffix,false);
httpClient.setProgressListener(updateProgressBar);
if (!httpClient.fetchFile(jarFolder + file)) {
System.out.println("fetch file failed, will retry from normal location");
return false;
}
try {
final File fileObj=new File(jarFolder + file);
final int shouldSize=Integer.parseInt(updateProp.getProperty("file-size." + file,""));
if (fileObj.length() != shouldSize) {
System.out.println("wrong file size, will retry from normal location");
return false;
}
if (!SignatureVerifier.get().checkSignature(jarFolder + file,updateProp.getProperty("file-signature." + file))) {
System.out.println("signature verification failed");
return false;
}
bootProp.put("file-signature." + file,updateProp.getProperty("file-signature." + file));
}
catch ( final NumberFormatException e) {
e.printStackTrace(System.err);
return false;
}
return true;
}
| tries to download the file from a preferred, but less stable location. errors are only logged to stdout and not displayed to the user because if this download fails, the one from the normal location is tried. |
public OMGraphic createGraphic(SimpleBeanObject object){
if (!(object instanceof SimpleBeanContainer)) {
throw new IllegalArgumentException(object + " not instance of SimpleBeanContainer");
}
SimpleBeanContainer bc=(SimpleBeanContainer)object;
return new OMRect(bc.getTopLatitude(),bc.getLeftLongitude(),bc.getBottomLatitude(),bc.getRightLongitude(),OMGraphicConstants.LINETYPE_RHUMB);
}
| Returns an OMRect object with dimensions equal to the width and height of the SimpleBeanContainer and position equal to the center lat/lon position of the SimpleBeanContainer object. |
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"xlat");
if (instruction.getOperands().size() != 0) {
throw new InternalTranslationException("Error: Argument instruction is not a xlat instruction (invalid number of operands)");
}
final long baseOffset=instruction.getAddress().toLong() * 0x100;
final long offset=baseOffset;
final String isolatedAl=environment.getNextVariableString();
final String address=environment.getNextVariableString();
final String truncatedAddress=environment.getNextVariableString();
final String value=environment.getNextVariableString();
final String maskedEax=environment.getNextVariableString();
instructions.add(ReilHelpers.createAnd(offset,OperandSize.DWORD,"eax",OperandSize.DWORD,"255",OperandSize.DWORD,isolatedAl));
instructions.add(ReilHelpers.createAdd(offset + 1,OperandSize.DWORD,isolatedAl,OperandSize.DWORD,"ebx",OperandSize.QWORD,address));
instructions.add(ReilHelpers.createAnd(offset + 2,OperandSize.QWORD,address,OperandSize.DWORD,"4294967295",OperandSize.DWORD,truncatedAddress));
instructions.add(ReilHelpers.createLdm(offset + 3,OperandSize.DWORD,address,OperandSize.BYTE,value));
instructions.add(ReilHelpers.createAnd(offset + 4,OperandSize.DWORD,"eax",OperandSize.DWORD,"4294967040",OperandSize.DWORD,maskedEax));
instructions.add(ReilHelpers.createOr(offset + 5,OperandSize.BYTE,value,OperandSize.DWORD,maskedEax,OperandSize.DWORD,"eax"));
}
| Translates a XLAT instruction to REIL code. |
private static int toHex(int ch){
if (ch >= '0' && ch <= '9') return ch - '0';
else if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
else if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
else return -1;
}
| Convert a character to hex |
@Override public <T extends DataObject>Iterator<T> find(Class<T> clazz,String field,Collection<? extends Object> value) throws DatabaseException {
return join(clazz,"one",field,value).go().iterator("one");
}
| retrieves all DbObjects of a certain type filtered by one String field's value |
private static RegistryEntry[] filter(String string,String branch,short type) throws RegistryException {
branch=ListUtil.trim(branch,"\\");
StringBuffer result=new StringBuffer();
ArrayList array=new ArrayList();
String[] arr=string.split("\n");
for (int i=0; i < arr.length; i++) {
String line=arr[i].trim();
int indexDWORD=line.indexOf(RegistryEntry.REGDWORD_TOKEN);
int indexSTRING=line.indexOf(RegistryEntry.REGSTR_TOKEN);
if ((indexDWORD != -1) || (indexSTRING != -1)) {
int index=(indexDWORD == -1) ? indexSTRING : indexDWORD;
int len=(indexDWORD == -1) ? lenSTRING : lenDWORD;
short _type=(indexDWORD == -1) ? RegistryEntry.TYPE_STRING : RegistryEntry.TYPE_DWORD;
if (result.length() > 0) result.append("\n");
String _key=line.substring(0,index).trim();
String _value=StringUtil.substringEL(line,index + len + 1,"").trim();
if (_key.equals(NO_NAME)) _key="";
if (_type == RegistryEntry.TYPE_DWORD) _value=String.valueOf(ParseNumber.invoke(_value.substring(2),"hex",0));
RegistryEntry re=new RegistryEntry(_type,_key,_value);
if (type == RegistryEntry.TYPE_ANY || type == re.getType()) array.add(re);
}
else if (line.indexOf(branch) == 0 && (type == RegistryEntry.TYPE_ANY || type == RegistryEntry.TYPE_KEY)) {
line=ListUtil.trim(line,"\\");
if (branch.length() < line.length()) {
array.add(new RegistryEntry(RegistryEntry.TYPE_KEY,ListUtil.last(line,"\\",true),""));
}
}
}
return (RegistryEntry[])array.toArray(new RegistryEntry[array.size()]);
}
| filter registry entries from the raw result |
public static Class[] primitivesToWrappers(Class[] classes){
if (classes == null) {
return null;
}
if (classes.length == 0) {
return classes;
}
Class[] convertedClasses=new Class[classes.length];
for (int i=0; i < classes.length; i++) {
convertedClasses[i]=primitiveToWrapper(classes[i]);
}
return convertedClasses;
}
| <p>Converts the specified array of primitive Class objects to an array of its corresponding wrapper Class objects.</p> |
public SpreadsheetEntry(BaseEntry sourceEntry){
super(sourceEntry);
getCategories().add(CATEGORY);
}
| Constructs a new entry by doing a shallow copy from another BaseEntry instance. |
public boolean isEmpty(){
return names.isEmpty();
}
| Returns <code>true</code> if this object contains no members. |
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter,java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix=xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix=generatePrefix(namespace);
while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
prefix=org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix,namespace);
xmlWriter.setPrefix(prefix,namespace);
}
return prefix;
}
| Register a namespace prefix |
BarChart(Type type){
mType=type;
}
| Instantiates a new bar chart. |
public static <T>Range<T> atMost(T v){
return range(null,null,v,BoundType.CLOSED);
}
| (-INF..b] (inclusive) |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:02:39.306 -0500",hash_original_method="4E298BD73CB3CE4838A0E376A85EE2C2",hash_generated_method="9F8B92C222B5ED89131795F1C9479C84") public static void execShell(String command){
nativeExecShell(command);
}
| Executes "/system/bin/sh -c <command>" using the exec() system call. This method never returns. |
public UiBuilder<T> alignLeft(){
this.control.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER,false,false,1,1));
return this;
}
| Aligns the created widget to the left. |
public CodeIterator iterator(){
return new CodeIterator(this);
}
| Makes a new iterator for reading this code attribute. |
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
super.onActivityResult(requestCode,resultCode,data);
if (requestCode == RC_GOOGLE_LOGIN) {
GoogleSignInResult result=Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
| This callback is triggered when any startActivityForResult finishes. The requestCode maps to the value passed into startActivityForResult. |
public Node parent(){
return parent;
}
| Returns the parent of the node. |
public boolean isDrawNodeStateSymbol(){
return this.drawNodeStateSymbol;
}
| Will the renderer draw a symbol to indicate that the node is expanded or collapsed (applies only to non-leaf nodes). The default symbol is a triangle pointing to the right, for collapsed nodes, or down for expanded nodes. |
private String computeMd5Hash(String buffer){
MessageDigest md;
try {
md=MessageDigest.getInstance("MD5");
return bytesToHex(md.digest(buffer.getBytes("UTF-8")));
}
catch ( NoSuchAlgorithmException ignore) {
}
catch ( UnsupportedEncodingException e) {
}
return "";
}
| Needed for the Digest Access Authentication. |
public static String correctFileName(String f){
f=f.replace('\\','/');
if (f.startsWith("/")) {
f=f.substring(1);
}
return f;
}
| Fix the file name, replacing backslash with slash. |
public acronym addElement(String hashcode,String element){
addElementToRegistry(hashcode,element);
return (this);
}
| Adds an Element to the element. |
@Override protected int calcAttackValue(){
int av=super.calcAttackValue();
if (usesClusterTable()) {
return (int)Math.floor(0.6 * av);
}
if (bDirect) {
av=Math.min(av + (toHit.getMoS() / 3),av * 2);
}
if (bGlancing) {
av=(int)Math.floor(av / 2.0);
}
av=(int)Math.floor(getBracketingMultiplier() * av);
return av;
}
| Calculate the attack value based on range |
public void types(String types[]){
this.types=types;
}
| Callback method used while the query is executed. |
public void startDownload(final String hostname,final String uri,final int reportInterval){
startDownload(hostname,SpeedTestConst.HTTP_DEFAULT_PORT,uri,reportInterval);
}
| Start download process with default to port 80 with specified report interval. |
public Attr createAttributeNS(String namespaceURI,String qualifiedName) throws DOMException {
error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
return null;
}
| Unimplemented. See org.w3c.dom.Document |
public BasePlannable compile(DMLStatementNode stmt,List<ParameterNode> params){
return compile(stmt,params,new PlanContext(this));
}
| Compile a statement into an operator tree. |
public boolean findUniqueBoolean(@NotNull SqlQuery query){
return executeQuery(rowMapperForClass(boolean.class).unique(),query);
}
| A convenience method for retrieving a single non-null boolean. |
public int hashCode(){
long bits=1L;
bits=31L * bits + VecMathUtil.floatToIntBits(x);
bits=31L * bits + VecMathUtil.floatToIntBits(y);
bits=31L * bits + VecMathUtil.floatToIntBits(z);
return (int)(bits ^ (bits >> 32));
}
| Returns a hash code value based on the data values in this object. Two different Vec3D objects with identical data values (i.e., Vec3D.equals returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely. |
public Boolean canRunInParallel(){
return this.run_in_parallel;
}
| Returns if the job can run in parallel with the previous step. |
private String createNonCGSrdfPairStepsOnPopulatedGroup(List<VolumeDescriptor> sourceDescriptors,List<VolumeDescriptor> targetDescriptors,RemoteDirectorGroup group,Map<URI,Volume> uriVolumeMap,String waitFor,Workflow workflow){
StorageSystem system=dbClient.queryObject(StorageSystem.class,group.getSourceStorageSystemUri());
URI vpoolChangeUri=getVirtualPoolChangeVolume(sourceDescriptors);
log.info("VPoolChange URI {}",vpoolChangeUri);
List<URI> sourceURIs=VolumeDescriptor.getVolumeURIs(sourceDescriptors);
List<URI> targetURIs=new ArrayList<>();
for ( URI sourceURI : sourceURIs) {
Volume source=uriVolumeMap.get(sourceURI);
StringSet srdfTargets=source.getSrdfTargets();
for ( String targetStr : srdfTargets) {
URI targetURI=URI.create(targetStr);
targetURIs.add(targetURI);
}
}
Method suspendGroupMethod=suspendSRDFGroupMethod(system.getId(),group,sourceURIs,targetURIs);
Method resumeRollbackMethod=resumeSRDFGroupMethod(system.getId(),group,sourceURIs,targetURIs);
String suspendGroupStep=workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP,SUSPEND_SRDF_MIRRORS_STEP_DESC,waitFor,system.getId(),system.getSystemType(),getClass(),suspendGroupMethod,resumeRollbackMethod,null);
Method createListMethod=createListReplicasMethod(system.getId(),sourceURIs,targetURIs,vpoolChangeUri,false);
Method rollbackMethod=rollbackSRDFLinksMethod(system.getId(),sourceURIs,targetURIs,false);
String createListReplicaStep=workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP,CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_DESC,suspendGroupStep,system.getId(),system.getSystemType(),getClass(),createListMethod,rollbackMethod,null);
Method resumeGroupMethod=resumeSRDFGroupMethod(system.getId(),group,sourceURIs,targetURIs);
String resumeGroupStep=workflow.createStep(CREATE_SRDF_ACTIVE_VOLUME_PAIR_STEP_GROUP,RESUME_SRDF_MIRRORS_STEP_DESC,createListReplicaStep,system.getId(),system.getSystemType(),getClass(),resumeGroupMethod,rollbackMethodNullMethod(),null);
return resumeGroupStep;
}
| This method creates steps to create SRDF pairs in a populated SRDF group. |
public static double xlogx(int c){
if (c == 0) {
return 0.0;
}
return c * Utils.log2((double)c);
}
| Returns c*log2(c) for a given integer value c. |
public int E(){
return E;
}
| Returns the number of edges in the edge-weighted digraph. |
@Override protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
final File workDir=new File(FS_WORK_DIR);
if (!workDir.exists()) assert workDir.mkdirs();
LocalIgfsSecondaryFileSystem second=new LocalIgfsSecondaryFileSystem();
second.setWorkDirectory(workDir.getAbsolutePath());
igfsSecondary=new IgfsLocalSecondaryFileSystemTestAdapter(workDir);
return second;
}
| Creates secondary filesystems. |
static StringBuilder newStringBuilderForCollection(int size){
checkNonnegative(size,"size");
return new StringBuilder((int)Math.min(size * 8L,Ints.MAX_POWER_OF_TWO));
}
| Returns best-effort-sized StringBuilder based on the given collection size. |
private byte[] calculateGeneralEncryptionKey(byte[] userPassword,byte[] firstDocIdValue,int keyBitLength,int revision,byte[] oValue,int pValue,boolean encryptMetadata) throws GeneralSecurityException {
final byte[] paddedPassword=padPassword(userPassword);
MessageDigest md5=createMD5Digest();
md5.reset();
md5.update(paddedPassword);
md5.update(oValue);
md5.update((byte)(pValue & 0xFF));
md5.update((byte)((pValue >> 8) & 0xFF));
md5.update((byte)((pValue >> 16) & 0xFF));
md5.update((byte)(pValue >> 24));
if (firstDocIdValue != null) {
md5.update(firstDocIdValue);
}
if (revision >= 4 && !encryptMetadata) {
for (int i=0; i < 4; ++i) {
md5.update((byte)0xFF);
}
}
byte[] hash=md5.digest();
final int keyLen=revision == 2 ? 5 : (keyBitLength / 8);
final byte[] key=new byte[keyLen];
if (revision >= 3) {
for (int i=0; i < 50; ++i) {
md5.update(hash,0,key.length);
digestTo(md5,hash);
}
}
System.arraycopy(hash,0,key,0,key.length);
return key;
}
| Determine what the general encryption key is, given a configuration. This corresponds to Algorithm 3.2 of PDF Reference version 1.7. |
public static GraphAndPopulationsSynchronizer synchronize(final IPopulation popVertices,final IPopulation popEdges,final IGraph graph){
final GraphAndPopulationsSynchronizer res=new GraphAndPopulationsSynchronizer(popVertices,popEdges,graph);
popVertices.addListener(res);
popEdges.addListener(res);
graph.addListener(res);
return res;
}
| Creates a synchronizer which listens for a population of vertices and updates the graph accordingly |
public void dispose(){
mRed=null;
mGreen=null;
jmri.InstanceManager.turnoutManagerInstance().removeVetoableChangeListener(this);
super.dispose();
}
| Remove references to and from this object, so that it can eventually be garbage-collected. |
public void startDTD(String name,String publicId,String systemId) throws org.xml.sax.SAXException {
}
| Report the start of DTD declarations, if any. Any declarations are assumed to be in the internal subset unless otherwise indicated. |
public static void main(String[] argv) throws IOException, SAXException {
Scanner s=new HTMLScanner();
Reader r=new InputStreamReader(System.in,"UTF-8");
Writer w=new OutputStreamWriter(System.out,"UTF-8");
PYXWriter pw=new PYXWriter(w);
s.scan(r,pw);
w.close();
}
| Test procedure. Reads HTML from the standard input and writes PYX to the standard output. |
public static void showNotification(Project project,MessageType type,String text){
StatusBar statusBar=WindowManager.getInstance().getStatusBar(project);
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text,type,null).setFadeoutTime(7500).createBalloon().show(RelativePoint.getCenterOf(statusBar.getComponent()),Balloon.Position.atRight);
}
| Display simple notification of given type |
private void joinSubClasses(JClass superJc){
Set<JClass> subJClasses=superJc.getSubJClasses();
for ( JClass subJc : subJClasses) {
subJc.setJoinToAlias(superJc.getJoinToAlias());
subJc.setJoinToField(superJc.getJoinToField());
subJc.setField(superJc.getField());
subJc.setMaxCacheSize(superJc.getMaxCacheSize());
subJc.setSelections(superJc.getSelections());
queryClass(subJc);
superJc.getUris().addAll(subJc.getUris());
log.info("Processing subclass: " + subJc.getClazz().getSimpleName() + " count: "+ subJc.getUris().size());
subJc.getUris().clear();
Map<URI,Set<URI>> subJoinMap=subJc.getJoinMap();
for ( Entry<URI,Set<URI>> entry : subJoinMap.entrySet()) {
if (superJc.getJoinMap().get(entry.getKey()) == null) {
superJc.getJoinMap().put(entry.getKey(),new HashSet<URI>());
}
Map<URI,Set<URI>> superJoinMap=superJc.getJoinMap();
superJoinMap.get(entry.getKey()).addAll(entry.getValue());
}
subJc.getJoinMap().clear();
Map<URI,Object> subCachedObjects=subJc.getCachedObjects();
superJc.getCachedObjects().putAll(subCachedObjects);
subCachedObjects.clear();
}
}
| Performs a join of each of the subclasses, followed by a union of the results. |
public static JsonObject buildModRedisConfig(String redisHost,int redisPort){
JsonObject config=new JsonObject();
config.put("host",redisHost);
config.put("port",redisPort);
config.put("encoding","UTF-8");
return config;
}
| Builds a standard mod redis configuration. |
public void recompilationStarted(CompilationPlan plan){
if (Controller.options.LOGGING_LEVEL >= 2) {
printlnToLogWithTimePrefix("Recompiling (at level " + plan.options.getOptLevel() + ") "+ plan.method);
}
}
| This method logs the beginning of an adaptively selected recompilation |
protected void refillBuffer(){
if (pendinglen > 0 || eof) return;
try {
offset=0;
pendinglen=stream.read(buf);
if (pendinglen < 0) {
close();
return;
}
else return;
}
catch ( IOException e) {
throw new PngjInputException(e);
}
}
| If there are not pending bytes to be consumed tries to fill the buffer with bytes from the stream. |
public String selectedAttributesTipText(){
return "The attributes (index range string or explicit " + "comma-separated attribute names) to work on";
}
| Returns the tip text for this property |
public XYCoordinate(double x,double y){
this.x=x;
this.y=y;
}
| Creates a new coordinate for the point (x, y). |
public long manhattanDistance(final Int2D p){
return Math.abs((long)this.x - p.x) + Math.abs((long)this.y - p.y);
}
| Returns the manhattan distance FROM this MutableInt2D TO the specified point. |
public static void main(String[] args) throws IllegalArgumentException {
FlagConfig flagConfig;
try {
flagConfig=FlagConfig.getFlagConfig(args);
args=flagConfig.remainingArgs;
}
catch ( IllegalArgumentException e) {
System.out.println(usageMessage);
throw e;
}
if (flagConfig.luceneindexpath().isEmpty()) {
throw (new IllegalArgumentException("-luceneindexpath must be set."));
}
String luceneIndex=flagConfig.luceneindexpath();
if (!flagConfig.initialtermvectors().isEmpty()) {
try {
VectorStoreRAM vsr=new VectorStoreRAM(flagConfig);
vsr.initFromFile(flagConfig.initialtermvectors());
newElementalTermVectors=vsr;
VerbatimLogger.info("Using trained index vectors from vector store " + flagConfig.initialtermvectors());
}
catch ( IOException e) {
logger.info("Could not read from vector store " + flagConfig.initialtermvectors());
System.out.println(usageMessage);
throw new IllegalArgumentException();
}
}
String termFile="";
switch (flagConfig.positionalmethod()) {
case BASIC:
termFile=flagConfig.termtermvectorsfile();
break;
case PROXIMITY:
termFile=flagConfig.proximityvectorfile();
break;
case PERMUTATION:
termFile=flagConfig.permutedvectorfile();
break;
case PERMUTATIONPLUSBASIC:
termFile=flagConfig.permplustermvectorfile();
break;
case DIRECTIONAL:
termFile=flagConfig.directionalvectorfile();
break;
case EMBEDDINGS:
termFile=flagConfig.embeddingvectorfile();
break;
default :
throw new IllegalArgumentException("Unrecognized -positionalmethod: " + flagConfig.positionalmethod());
}
VerbatimLogger.info("Building positional index, Lucene index: " + luceneIndex + ", Seedlength: "+ flagConfig.seedlength()+ ", Vector length: "+ flagConfig.dimension()+ ", Vector type: "+ flagConfig.vectortype()+ ", Minimum term frequency: "+ flagConfig.minfrequency()+ ", Maximum term frequency: "+ flagConfig.maxfrequency()+ ", Number non-alphabet characters: "+ flagConfig.maxnonalphabetchars()+ ", Window radius: "+ flagConfig.windowradius()+ ", Fields to index: "+ Arrays.toString(flagConfig.contentsfields())+ "\n");
try {
TermTermVectorsFromLucene termTermIndexer=new TermTermVectorsFromLucene(flagConfig,newElementalTermVectors);
if (!flagConfig.positionalmethod().equals(PositionalMethod.EMBEDDINGS)) for (int i=1; i < flagConfig.trainingcycles(); ++i) {
newElementalTermVectors=termTermIndexer.getSemanticTermVectors();
VerbatimLogger.info("\nRetraining with learned term vectors ...");
termTermIndexer=new TermTermVectorsFromLucene(flagConfig,newElementalTermVectors);
}
if (!flagConfig.positionalmethod().equals(PositionalMethod.EMBEDDINGS) || flagConfig.docindexing().equals(DocIndexingStrategy.NONE)) {
Enumeration<ObjectVector> e=termTermIndexer.getSemanticTermVectors().getAllVectors();
while (e.hasMoreElements()) {
e.nextElement().getVector().normalize();
}
}
if (flagConfig.docindexing() != DocIndexingStrategy.NONE) {
IncrementalDocVectors.createIncrementalDocVectors(termTermIndexer.getSemanticTermVectors(),flagConfig,new LuceneUtils(flagConfig));
if (flagConfig.positionalmethod().equals(PositionalMethod.EMBEDDINGS)) {
Enumeration<ObjectVector> e=termTermIndexer.getSemanticTermVectors().getAllVectors();
while (e.hasMoreElements()) {
e.nextElement().getVector().normalize();
}
}
}
VectorStoreWriter.writeVectors(termFile,flagConfig,termTermIndexer.getSemanticTermVectors());
}
catch (IOException e) {
e.printStackTrace();
}
}
| Builds term vector stores from a Lucene index - this index must contain TermPositionVectors. |
@RequestMapping(value="/businessObjectDefinitions/namespaces/{namespace}/businessObjectDefinitionNames/{businessObjectDefinitionName}",method=RequestMethod.DELETE) @Secured(SecurityFunctions.FN_BUSINESS_OBJECT_DEFINITIONS_DELETE) public BusinessObjectDefinition deleteBusinessObjectDefinition(@PathVariable("namespace") String namespace,@PathVariable("businessObjectDefinitionName") String businessObjectDefinitionName){
BusinessObjectDefinitionKey businessObjectDefinitionKey=new BusinessObjectDefinitionKey(namespace,businessObjectDefinitionName);
return businessObjectDefinitionService.deleteBusinessObjectDefinition(businessObjectDefinitionKey);
}
| Deletes an existing business object definition by key. <p>Requires WRITE permission on namespace</p> |
public static void insert(String accountName,String deviceId,String deviceToken,String messageTypeId) throws IOException {
URL url=new URL("https://iotmms" + accountName + ".hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/"+ deviceId);
HttpURLConnection connection=(HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type","application/json;charset=utf-8");
connection.setRequestProperty("Authorization","Bearer " + deviceToken);
String body="{\"mode\":\"async\", \"messageType\":\"" + messageTypeId + "\", \"messages\":[{\"sensor\":\"sensor1\", \"value\":\"20\", \"timestamp\":1468991773}]}";
byte[] outputInBytes=body.getBytes("UTF-8");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
OutputStream outputStream=connection.getOutputStream();
outputStream.write(outputInBytes);
outputStream.close();
InputStream inputStream=null;
if (connection.getResponseCode() >= 400) {
inputStream=connection.getErrorStream();
}
else {
inputStream=connection.getInputStream();
}
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream));
String line;
StringBuffer response=new StringBuffer();
while ((line=bufferedReader.readLine()) != null) {
response.append(line);
response.append('\r');
}
bufferedReader.close();
System.out.println(response.toString());
}
| Sends messages to MMS |
public ServiceImpl(){
}
| Here for spring friendly config |
public static CreativeTabs tabMekanism(CreativeTabs preferred){
try {
if (Mekanism == null) {
Mekanism=Class.forName("mekanism.common.Mekanism");
}
Object ret=Mekanism.getField("tabMekanism").get(null);
if (ret instanceof CreativeTabs) {
return (CreativeTabs)ret;
}
return preferred;
}
catch ( Exception e) {
System.err.println("Error retrieving Mekanism creative tab.");
return preferred;
}
}
| Attempts to get the Mekanism creative tab instance from the 'Mekanism' class. Will return the tab if the mod is loaded, but otherwise will return the defined 'preferred' creative tab. This way you don't need to worry about NPEs! |
private void updateUnmanagedVolume(VPlexVirtualVolumeInfo info,StorageSystem vplex,UnManagedVolume volume,Map<String,String> volumesToCgs,Map<String,String> clusterIdToNameMap,Map<String,String> varrayToClusterIdMap,Map<String,String> distributedDevicePathToClusterMap,Map<String,String> backendVolumeGuidToVvolGuidMap,Map<String,Set<VPlexStorageViewInfo>> volumeToStorageViewMap,Collection<VirtualPool> allVpools){
s_logger.info("Updating UnManagedVolume {} with latest from VPLEX volume {}",volume.getLabel(),info.getName());
volume.setStorageSystemUri(vplex.getId());
volume.setNativeGuid(info.getPath());
volume.setLabel(info.getName());
volume.setWwn(info.getWwn());
volume.getUnmanagedExportMasks().clear();
volume.getInitiatorUris().clear();
volume.getInitiatorNetworkIds().clear();
Map<String,StringSet> unManagedVolumeInformation=new HashMap<String,StringSet>();
StringMap unManagedVolumeCharacteristics=new StringMap();
StringSet bwValues=new StringSet();
bwValues.add("0");
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString(),bwValues);
}
else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()).replace(bwValues);
}
StringSet iopsVal=new StringSet();
iopsVal.add("0");
if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) == null) {
unManagedVolumeInformation.put(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString(),iopsVal);
}
else {
unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()).replace(iopsVal);
}
if (volumesToCgs.containsKey(info.getName())) {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(),TRUE);
StringSet set=new StringSet();
set.add(volumesToCgs.get(info.getName()));
unManagedVolumeInformation.put(SupportedVolumeInformation.VPLEX_CONSISTENCY_GROUP_NAME.toString(),set);
}
else {
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(),FALSE);
}
StringSet systemTypes=new StringSet();
systemTypes.add(vplex.getSystemType());
unManagedVolumeInformation.put(SupportedVolumeInformation.SYSTEM_TYPE.toString(),systemTypes);
StringSet provCapacity=new StringSet();
provCapacity.add(String.valueOf(info.getCapacityBytes()));
StringSet allocatedCapacity=new StringSet();
allocatedCapacity.add(String.valueOf(0));
unManagedVolumeInformation.put(SupportedVolumeInformation.PROVISIONED_CAPACITY.toString(),provCapacity);
unManagedVolumeInformation.put(SupportedVolumeInformation.ALLOCATED_CAPACITY.toString(),allocatedCapacity);
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_VPLEX_VOLUME.toString(),TRUE);
StringSet locality=new StringSet();
locality.add(info.getLocality());
unManagedVolumeInformation.put(SupportedVolumeInformation.VPLEX_LOCALITY.toString(),locality);
StringSet supportingDevice=new StringSet();
supportingDevice.add(info.getSupportingDevice());
unManagedVolumeInformation.put(SupportedVolumeInformation.VPLEX_SUPPORTING_DEVICE_NAME.toString(),supportingDevice);
StringSet volumeClusters=new StringSet();
volumeClusters.addAll(info.getClusters());
unManagedVolumeInformation.put(SupportedVolumeInformation.VPLEX_CLUSTER_IDS.toString(),volumeClusters);
StringSet accesses=new StringSet();
accesses.add(Volume.VolumeAccessState.READWRITE.getState());
unManagedVolumeInformation.put(SupportedVolumeInformation.ACCESS.toString(),accesses);
StringSet matchedVPools=new StringSet();
String highAvailability=info.getLocality().equals(LOCAL) ? VirtualPool.HighAvailabilityType.vplex_local.name() : VirtualPool.HighAvailabilityType.vplex_distributed.name();
s_logger.info("finding valid virtual pools for UnManagedVolume {}",volume.getLabel());
for ( VirtualPool vpool : allVpools) {
if (!vpool.getHighAvailability().equals(highAvailability) && !(VirtualPool.vPoolSpecifiesRPVPlex(vpool) && highAvailability.equals(VirtualPool.HighAvailabilityType.vplex_local.name()))) {
s_logger.info(" virtual pool {} is not valid because " + "its high availability setting does not match the unmanaged volume",vpool.getLabel());
continue;
}
Boolean mvConsistency=vpool.getMultivolumeConsistency();
if ((TRUE.equals(unManagedVolumeCharacteristics.get(SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString()))) && ((mvConsistency == null) || (mvConsistency == Boolean.FALSE))) {
s_logger.info(" virtual pool {} is not valid because it does not have the " + "multi-volume consistency flag set, and the unmanaged volume is in a consistency group",vpool.getLabel());
continue;
}
StringSet varraysForVpool=vpool.getVirtualArrays();
for ( String varrayId : varraysForVpool) {
String varrayClusterId=varrayToClusterIdMap.get(varrayId);
if (null == varrayClusterId) {
varrayClusterId=ConnectivityUtil.getVplexClusterForVarray(URI.create(varrayId),vplex.getId(),_dbClient);
varrayToClusterIdMap.put(varrayId,varrayClusterId);
}
if (!ConnectivityUtil.CLUSTER_UNKNOWN.equals(varrayClusterId)) {
String varrayClusterName=clusterIdToNameMap.get(varrayClusterId);
if (volumeClusters.contains(varrayClusterName)) {
matchedVPools.add(vpool.getId().toString());
break;
}
}
}
if (!matchedVPools.contains(vpool.getId().toString())) {
s_logger.info(" virtual pool {} is not valid because " + "the volume resides on a cluster that does not match the varray(s) associated with the vpool",vpool.getLabel());
}
}
String thinlyProvisioned=info.isThinEnabled() ? TRUE : FALSE;
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_THINLY_PROVISIONED.toString(),thinlyProvisioned);
volume.setVolumeCharacterstics(unManagedVolumeCharacteristics);
volume.addVolumeInformation(unManagedVolumeInformation);
String discoveryMode=ControllerUtils.getPropertyValueFromCoordinator(_coordinator,VplexBackendIngestionContext.DISCOVERY_MODE);
if (!VplexBackendIngestionContext.DISCOVERY_MODE_INGESTION_ONLY.equals(discoveryMode)) {
try {
VplexBackendIngestionContext context=new VplexBackendIngestionContext(volume,_dbClient);
context.setDistributedDevicePathToClusterMap(distributedDevicePathToClusterMap);
context.discover();
for ( UnManagedVolume bvol : context.getUnmanagedBackendVolumes()) {
backendVolumeGuidToVvolGuidMap.put(bvol.getNativeGuid(),volume.getNativeGuid());
String isFullCopyStr=bvol.getVolumeCharacterstics().get(SupportedVolumeCharacterstics.IS_FULL_COPY.toString());
boolean isFullCopy=(null != isFullCopyStr && Boolean.parseBoolean(isFullCopyStr));
if (isFullCopy) {
String fullCopySourceBvol=VplexBackendIngestionContext.extractValueFromStringSet(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(),bvol.getVolumeInformation());
if (fullCopySourceBvol != null && !fullCopySourceBvol.isEmpty()) {
StringSet set=new StringSet();
set.add(fullCopySourceBvol);
volume.putVolumeInfo(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(),set);
volume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_FULL_COPY.toString(),Boolean.TRUE.toString());
}
}
String hasReplicasStr=bvol.getVolumeCharacterstics().get(SupportedVolumeCharacterstics.HAS_REPLICAS.toString());
boolean hasReplicas=(null != hasReplicasStr && Boolean.parseBoolean(hasReplicasStr));
if (hasReplicas) {
StringSet fullCopyTargetBvols=bvol.getVolumeInformation().get(SupportedVolumeInformation.FULL_COPIES.name());
if (fullCopyTargetBvols != null && !fullCopyTargetBvols.isEmpty()) {
StringSet parentSet=volume.getVolumeInformation().get(SupportedVolumeInformation.FULL_COPIES.name());
if (parentSet == null) {
parentSet=new StringSet();
}
for ( String fullCopyTargetBvol : fullCopyTargetBvols) {
parentSet.add(fullCopyTargetBvol);
}
volume.putVolumeInfo(SupportedVolumeInformation.FULL_COPIES.name(),parentSet);
volume.putVolumeCharacterstics(SupportedVolumeCharacterstics.HAS_REPLICAS.toString(),Boolean.TRUE.toString());
}
}
String replicaState=VplexBackendIngestionContext.extractValueFromStringSet(SupportedVolumeInformation.REPLICA_STATE.name(),bvol.getVolumeInformation());
if (replicaState != null && !replicaState.isEmpty()) {
StringSet set=new StringSet();
set.add(replicaState);
volume.putVolumeInfo(SupportedVolumeInformation.REPLICA_STATE.name(),set);
}
String syncActive=VplexBackendIngestionContext.extractValueFromStringSet(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(),bvol.getVolumeInformation());
if (syncActive != null && !syncActive.isEmpty()) {
StringSet set=new StringSet();
set.add(syncActive);
volume.putVolumeInfo(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(),set);
}
}
s_logger.info(context.getPerformanceReport());
}
catch ( Exception ex) {
s_logger.warn("error discovering backend structure for {}: ",volume.getNativeGuid(),ex);
}
}
unManagedVolumeCharacteristics.put(SupportedVolumeCharacterstics.IS_INGESTABLE.toString(),TRUE);
if (null == matchedVPools || matchedVPools.isEmpty()) {
volume.getSupportedVpoolUris().clear();
s_logger.info("No matching VPOOLS found for unmanaged volume " + volume.getLabel());
}
else {
volume.getSupportedVpoolUris().replace(matchedVPools);
s_logger.info("Replaced Pools : {}",volume.getSupportedVpoolUris());
}
Set<VPlexStorageViewInfo> svs=volumeToStorageViewMap.get(volume.getLabel());
if (svs != null) {
updateWwnAndHluInfo(volume,svs);
}
}
| Updates an existing UnManagedVolume with the latest info from the VPLEX virtual volume. |
public static Rect rect(double minX,double minY,double maxX,double maxY){
Rect rect=new Rect();
rect.xMin=(int)(minX * SwfConstants.TWIPS_PER_PIXEL);
rect.yMin=(int)(minY * SwfConstants.TWIPS_PER_PIXEL);
rect.xMax=(int)(maxX * SwfConstants.TWIPS_PER_PIXEL);
rect.yMax=(int)(maxY * SwfConstants.TWIPS_PER_PIXEL);
return rect;
}
| Creates a SWF Rect from double precision coordinate pairs (in pixels) that specify the top left corner (minX, minY) and the bottom right corner (maxX, maxY). The values are converted into twips (1/20th of pixel) and rounded to an integer as required by the SWF format. |
@Override public final boolean isEncrypted(){
return fileAccess.isEncrypted();
}
| return true if the current pdf file is encrypted <br> check <b>isFileViewable()</b>,<br> <br> if file is encrypted and not viewable - a user specified password is needed. |
public void run(){
AbstractDocument doc=(AbstractDocument)getDocument();
try {
doc.readLock();
if (minorValid && majorValid && childSizeValid) {
return;
}
if (child.getParent() == AsyncBoxView.this) {
synchronized (AsyncBoxView.this) {
changing=this;
}
updateChild();
synchronized (AsyncBoxView.this) {
changing=null;
}
updateChild();
}
}
finally {
doc.readUnlock();
}
}
| Update the child state. This should be called by the thread that desires to spend time updating the child state (intended to be the layout thread). <p> This acquires a read lock on the associated document for the duration of the update to ensure the model is not changed while it is operating. The first thing to do would be to see if any work actually needs to be done. The following could have conceivably happened while the state was waiting to be updated: <ol> <li>The child may have been removed from the view hierarchy. <li>The child may have been updated by a higher priority operation (i.e. the child may have become visible). </ol> |
public final void writeBytes(String s) throws IOException {
int len=s.length();
for (int i=0; i < len; i++) {
out.write((byte)s.charAt(i));
}
incCount(len);
}
| Writes out the string to the underlying output stream as a sequence of bytes. Each character in the string is written out, in sequence, by discarding its high eight bits. If no exception is thrown, the counter <code>written</code> is incremented by the length of <code>s</code>. |
public CActionClone(final CGraphWindow parent,final INaviView view,final IViewContainer container){
super("Clone View");
m_parent=Preconditions.checkNotNull(parent,"IE01641: Parent can't be null");
m_view=Preconditions.checkNotNull(view,"IE01642: View argument can not be null");
m_container=Preconditions.checkNotNull(container,"IE01643: Container argument can not be null");
}
| Creates a new action object. |
public boolean requestBackup(Pair<TransportConfiguration,TransportConfiguration> connectorPair,int backupSize,boolean replicated) throws Exception {
ClusterController clusterController=server.getClusterManager().getClusterController();
try (ClusterControl clusterControl=clusterController.connectToNode(connectorPair.getA())){
clusterControl.authorize();
if (replicated) {
return clusterControl.requestReplicatedBackup(backupSize,server.getNodeID());
}
else {
return clusterControl.requestSharedStoreBackup(backupSize,server.getConfiguration().getJournalLocation().getAbsolutePath(),server.getConfiguration().getBindingsLocation().getAbsolutePath(),server.getConfiguration().getLargeMessagesLocation().getAbsolutePath(),server.getConfiguration().getPagingLocation().getAbsolutePath());
}
}
}
| send a request to a live server to start a backup for us |
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
try {
resBundle=JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
}
catch ( IOException ioe) {
throw new RuntimeException(ioe);
}
}
| This method re populates the resBundle during the deserialization process |
public void bytesReceived(int cnt){
bytesRcvd+=cnt;
lastRcvTime=U.currentTimeMillis();
}
| Adds given amount ob bytes to the received bytes counter. <p> Note that this method is designed to be called in one thread only. |
protected void add(ProposedResourceDelta delta){
if (children.size() == 0 && status == 0) setKind(IResourceDelta.CHANGED);
children.put(delta.getResource().getName(),delta);
}
| Adds a child delta to the list of children for this delta node. |
public boolean isSetKeys(){
return this.keys != null;
}
| Returns true if field keys is set (has been assigned a value) and false otherwise |
public static Object fromSpec(String spec) throws IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
return fromSpec(NO_CONTEXT,spec,Object.class,null,null);
}
| Creates a new instance from a specification. |
public Schema(){
}
| De-serialization ctor. |
void updateIM(IntersectionMatrix im){
for (Iterator it=iterator(); it.hasNext(); ) {
EdgeEndBundle esb=(EdgeEndBundle)it.next();
esb.updateIM(im);
}
}
| Update the IM with the contribution for the EdgeStubs around the node. |
public void evictAll() throws IOException {
cache.evictAll();
}
| Deletes all values stored in the cache. In-flight writes to the cache will complete normally, but the corresponding responses will not be stored. |
public static MoveStepType lateralShiftForTurn(final MoveStepType turn,final MoveStepType direction){
if (direction == MoveStepType.FORWARDS) {
switch (turn) {
case TURN_LEFT:
return MoveStepType.LATERAL_LEFT;
case TURN_RIGHT:
return MoveStepType.LATERAL_RIGHT;
default :
return turn;
}
}
switch (turn) {
case TURN_LEFT:
return MoveStepType.LATERAL_LEFT_BACKWARDS;
case TURN_RIGHT:
return MoveStepType.LATERAL_RIGHT_BACKWARDS;
default :
return turn;
}
}
| Returns the lateral shift that corresponds to the turn direction |
protected boolean afterSave(boolean newRecord,boolean success){
updateHeader();
return success;
}
| After Save |
@Override public void printStackTrace(PrintWriter pw){
super.printStackTrace(pw);
if (nested != null) {
nested.printStackTrace(pw);
}
}
| Prints the composite message and the embedded stack trace to the specified print writer pw. |
@Override public final void startElement(final String ns,final String lName,final String qName,final Attributes list) throws SAXException {
String name=lName == null || lName.length() == 0 ? qName : lName;
StringBuilder sb=new StringBuilder(match);
if (match.length() > 0) {
sb.append('/');
}
sb.append(name);
match=sb.toString();
Rule r=(Rule)RULES.match(match);
if (r != null) {
r.begin(name,list);
}
}
| Process notification of the start of an XML element being reached. |
@SuppressWarnings("ResultOfMethodCallIgnored") public void save(@NonNull File file,@NonNull MinecraftlyCore core){
try {
file.mkdirs();
file.delete();
file.createNewFile();
try (FileWriter fw=new FileWriter(file)){
fw.write(gson.toJson(this));
fw.flush();
}
}
catch ( IOException e1) {
core.getLogger().severe("Unable to save the default configuration!");
throw new RuntimeException("Error making default configuration!",e1);
}
}
| Save the configuration to a file. |
public void addDescription(Description description){
getDescriptions().add(description);
}
| Adds a new description. |
public int size(){
return encodedNames.size();
}
| The number of key-value pairs in this form-encoded body. |
public void evictAll(){
List<Connection> connections;
synchronized (this) {
connections=new ArrayList<Connection>(this.connections);
this.connections.clear();
}
for ( Connection connection : connections) {
Util.closeQuietly(connection);
}
}
| Close and remove all connections in the pool. |
protected void writeHistoryTable(final Writer w,@SuppressWarnings("rawtypes") final ICounter[] a,final PeriodEnum basePeriod,final TimestampFormatEnum timestampFormat) throws IOException {
if (w == null) throw new IllegalArgumentException();
if (a == null) throw new IllegalArgumentException();
if (a.length == 0) {
return;
}
if (basePeriod == null) throw new IllegalArgumentException();
if (timestampFormat == null) throw new IllegalArgumentException();
final HistoryTable t=new HistoryTable(a,basePeriod);
final DateFormat dateFormat;
switch (timestampFormat) {
case dateTime:
switch (basePeriod) {
case Minutes:
dateFormat=DateFormat.getTimeInstance(DateFormat.SHORT);
break;
case Hours:
dateFormat=DateFormat.getTimeInstance(DateFormat.MEDIUM);
break;
case Days:
dateFormat=DateFormat.getDateInstance(DateFormat.MEDIUM);
break;
default :
throw new AssertionError();
}
break;
case epoch:
dateFormat=null;
break;
default :
throw new AssertionError(timestampFormat.toString());
}
new HTMLHistoryTableRenderer(t,model.pattern,new HTMLValueFormatter(model)).render(w);
}
| Writes out a table containing the histories for the selected counters. |
public Name add(String comp) throws InvalidNameException {
impl.add(comp);
return this;
}
| Adds a single component to the end of this composite name. |
public String delete() throws Exception {
return SUCCESS;
}
| Override this method if you need to delete entities based on the id value after the PARAM interceptor is called. |
public static byte[] toByteArray(Reader input,String encoding) throws IOException {
return toByteArray(input,Charsets.toCharset(encoding));
}
| Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the specified character encoding. <p/> Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. <p/> This method buffers the input internally, so there is no need to use a <code>BufferedReader</code>. |
default boolean isScanMatchAnnotation(StringBuilder string){
return false;
}
| Returns true if the string matches an annotation class. |
private void openGallery(){
Intent intent=new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent,Const.RequestCode.GALLERY);
}
| open gallery to choose video |
public boolean empty(){
return individuals.size() == 0;
}
| Returns true is the population contains no individuals. |
private static void d_uamean(double[] a,double[] c,int m,int n,KahanObject kbuff,Mean kmean,int rl,int ru){
int len=Math.min((ru - rl) * n,a.length);
mean(a,rl * n,len,0,kbuff,kmean);
c[0]=kbuff._sum;
c[1]=len;
c[2]=kbuff._correction;
}
| MEAN, opcode: uamean, dense input. |
public void requestPreviewFrame(Handler handler,int message){
if (camera != null && previewing) {
previewCallback.setHandler(handler,message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
}
else {
camera.setPreviewCallback(previewCallback);
}
}
}
| A single preview frame will be returned to the handler supplied. The data will arrive as byte[] in the message.obj field, with width and height encoded as message.arg1 and message.arg2, respectively. |
public Hash(String algoId,String hashValue){
this.algoId=algoId;
this.hashValue=hashValue;
verifyFields();
}
| Constructs a hash object from a algorithm ID and hash value. |
private void assignRouteScoresByNumberOfTransactions(){
HashMap<Id,Integer> correlationCount=new HashMap<>();
for ( Id routeId : possibleMatsimRoutesSortedBynumberOfStops) {
ArrayList<Id> stopList=routeIdToStopIdSequence.get(routeId);
int score=0;
for ( CepasTransaction transaction : cepasTransactions) {
if (stopList.contains(transaction.stopId)) score++;
}
correlationCount.put(routeId,score);
}
routesSortedByNumberOfTransactions=new TreeSet<>(new ValueComparator(correlationCount));
routesSortedByNumberOfTransactions.addAll(correlationCount.keySet());
}
| Orders the possible Matsim routes for this line and direction by the number of transactions associated with the stops in the route |
public boolean isHasCharges(){
Object oo=get_Value(COLUMNNAME_HasCharges);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Charges. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.