code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static SynapseGroupDialog createSynapseGroupDialog(final NetworkPanel np,final SynapseGroup sg){
SynapseGroupDialog sgd=new SynapseGroupDialog(np,sg);
sgd.addListeners();
sgd.tabbedPane.setSelectedIndex(0);
return sgd;
}
| Creates a synapse group dialog based on a given synapse group it goes without saying that this means this dialog will be editing the given synapse group. |
@Override public int hashCode(){
return HashUtilities.hashCodeForDoubleArray(this.coefficients);
}
| Returns a hash code for this instance. |
@Override public List<Product> scroll(String clauses,int skip,int n){
checkProductNumber(n);
if (n < 0) n=ProductDao.getMaxPageSize();
return super.scroll(clauses,skip,n);
}
| Override Hibernate scroll to add the page size limitation. |
public XintroActivityBuilder withCustomImageLoader(ImageLoader customImageLoader){
this.customImageLoader=customImageLoader;
return this;
}
| With custom image loader. |
public MDTransformationRule makePassThroughRule(InputPort inputPort){
return new OneToManyPassThroughRule(inputPort,getManagedPorts());
}
| The generated rule copies all meta data from the input port to all generated output ports. |
public DigitalSignature(String algorithm){
try {
sha=MessageDigest.getInstance("SHA-1");
if ("RSA".equals(algorithm)) {
md5=MessageDigest.getInstance("MD5");
cipher=Cipher.getInstance("RSA/ECB/PKCS1Padding");
signature=null;
}
else if ("DSA".equals(algorithm)) {
signature=Signature.getInstance("NONEwithDSA");
cipher=null;
md5=null;
}
else {
cipher=null;
signature=null;
md5=null;
}
}
catch ( NoSuchAlgorithmException e) {
throw new AssertionError(e);
}
catch ( NoSuchPaddingException e) {
throw new AssertionError(e);
}
}
| Create Signature type |
public boolean unlockIt(){
log.info(toString());
setProcessing(false);
return true;
}
| Unlock Document. |
public <T extends ManagedEntity>T findByName(T[] entities,String name){
if (entities != null) {
for ( T entity : entities) {
if (StringUtils.equals(entity.getName(),name)) {
return entity;
}
}
}
return null;
}
| Finds a managed entity by name in an array (null-safe). |
public AtomicByteArray(int length){
this.length=length;
this.array=new AtomicIntegerArray((length + 3) / 4);
}
| Creates a new AtomicByteArray of the given length, with all elements initially zero. |
public static CompValidateChecker assertValidate(ICalComponent component){
return new CompValidateChecker(component);
}
| Asserts the validation of a component object. |
public void testParseCustomSimpleProperty(){
String toBeParsed="com.ibm.ssl.rootCertValidDays#" + " com.ibm.websphere.security.krb.canonical_host";
List<String> parsedProperty=ComplexPropertyUtils.parseProperty(toBeParsed,"#");
assertEquals(2,parsedProperty.size());
assertEquals("com.ibm.ssl.rootCertValidDays",parsedProperty.get(0));
assertEquals("com.ibm.websphere.security.krb.canonical_host",parsedProperty.get(1));
}
| Test parsing of provided simple property. |
private List<Byte> toList(byte[] bytes){
List<Byte> result=new ArrayList<Byte>();
for ( byte b : bytes) {
result.add(b);
}
return result;
}
| Arrays.asList() does not work with arrays of primitives. :( |
public SimpleReact(){
this(ThreadPools.getStandard());
}
| Construct a SimpleReact builder using standard thread pool. By default, unless ThreadPools is configured otherwise this will be sized to the available processors |
public void testSplit1(){
SplittableRandom sr=new SplittableRandom();
for (int reps=0; reps < REPS; ++reps) {
SplittableRandom sc=sr.split();
int i=0;
while (i < NCALLS && sr.nextLong() == sc.nextLong()) ++i;
assertTrue(i < NCALLS);
}
}
| A SplittableRandom produced by split() of a default-constructed SplittableRandom generates a different sequence |
@Override public Object clone(){
return new PolynominalAttribute(this);
}
| Clones this attribute. |
public static boolean initDebug(boolean InitCuda){
return StaticHelper.initOpenCV(InitCuda);
}
| Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java"). |
@SuppressWarnings("deprecation") public static String urlEncode(String s){
try {
return URLEncoder.encode(s,"UTF-8");
}
catch ( UnsupportedEncodingException e) {
return URLEncoder.encode(s);
}
}
| Return a URL encoded string, assuming "UTF-8" encoding for input. If UTF-8 is not supported, used default platform encoding. |
protected StyleSheetProcessingInstruction(){
}
| Creates a new ProcessingInstruction object. |
protected void visitPage(String page,String referer){
if (appsMode) {
ConnectionRequest req=GetGARequest();
req.addArgument("t","appview");
req.addArgument("an",Display.getInstance().getProperty("AppName","Codename One App"));
String version=Display.getInstance().getProperty("AppVersion","1.0");
req.addArgument("av",version);
req.addArgument("cd",page);
NetworkManager.getInstance().addToQueue(req);
}
else {
String url=Display.getInstance().getProperty("cloudServerURL","https://codename-one.appspot.com/") + "anal";
ConnectionRequest r=new ConnectionRequest();
r.setUrl(url);
r.setPost(false);
r.setFailSilently(failSilently);
r.addArgument("guid","ON");
r.addArgument("utmac",instance.agent);
r.addArgument("utmn",Integer.toString((int)(System.currentTimeMillis() % 0x7fffffff)));
if (page == null || page.length() == 0) {
page="-";
}
r.addArgument("utmp",page);
if (referer == null || referer.length() == 0) {
referer="-";
}
r.addArgument("utmr",referer);
r.addArgument("d",instance.domain);
r.setPriority(ConnectionRequest.PRIORITY_LOW);
NetworkManager.getInstance().addToQueue(r);
}
}
| Subclasses should override this method to track page visits |
public Message authResponse(ParameterList requestParams,String userSelId,String userSelClaimed,boolean authenticatedAndApproved){
return authResponse(requestParams,userSelId,userSelClaimed,authenticatedAndApproved,_opEndpointUrl,true);
}
| Processes a Authentication Request received from a consumer site. <p> Uses ServerManager's global OpenID Provider endpoint URL. |
public void checkValid(FactoryDto factory,boolean isUpdate) throws ConflictException {
if (null == factory) {
throw new ConflictException(FactoryConstants.UNPARSABLE_FACTORY_MESSAGE);
}
if (factory.getV() == null) {
throw new ConflictException(FactoryConstants.INVALID_VERSION_MESSAGE);
}
Version v;
try {
v=Version.fromString(factory.getV());
}
catch ( IllegalArgumentException e) {
throw new ConflictException(FactoryConstants.INVALID_VERSION_MESSAGE);
}
Class usedFactoryVersionMethodProvider;
switch (v) {
case V4_0:
usedFactoryVersionMethodProvider=FactoryDto.class;
break;
default :
throw new ConflictException(FactoryConstants.INVALID_VERSION_MESSAGE);
}
validateCompatibility(factory,null,FactoryDto.class,usedFactoryVersionMethodProvider,v,"",isUpdate);
}
| Validate factory compatibility. |
@Override public boolean equals(Object object){
return object == null || object == this;
}
| A Null object is equal to the null value and to itself. |
public void processTag(Tag tag){
String key=tag.getKey();
String value=tag.getValue();
if (key.equals("name")) {
nodeName=value;
}
else {
EntityAttribute att=EntityAttributeManager.instance().intern(new EntityAttribute(key,value));
if (att != null) nodeAttributes.add(att);
}
}
| This is called by child element processors when a tag object is encountered. |
public AbstractConnector(Figure owner){
this.owner=owner;
}
| Constructs a connector with the given owner figure. |
public static final StringBuilder stripArrows(final StringBuilder text){
int pointer2=text.length() - 1;
if (pointer2 >= 0) {
while (true) {
if ((text.charAt(pointer2) == '<') || (text.charAt(pointer2) == '>')) {
text.deleteCharAt(pointer2);
}
pointer2--;
if (pointer2 < 0) {
break;
}
}
}
return text;
}
| removes all the spaces |
@Inject CarrierControlerListener(Carriers carriers,CarrierPlanStrategyManagerFactory strategyManagerFactory,CarrierScoringFunctionFactory scoringFunctionFactory){
this.carriers=carriers;
this.carrierPlanStrategyManagerFactory=strategyManagerFactory;
this.carrierScoringFunctionFactory=scoringFunctionFactory;
}
| Constructs a controller with a set of carriers, re-planning capabilities and scoring-functions. |
public SVGClipDescriptor(String clipPathValue,Element clipPathDef){
if (clipPathValue == null) throw new SVGGraphics2DRuntimeException(ErrorConstants.ERR_CLIP_NULL);
this.clipPathValue=clipPathValue;
this.clipPathDef=clipPathDef;
}
| Creates a new SVGClipDescriptor. |
public static boolean isValidPassword(String password){
final int LENGTH_OF_VALID_PASSWORD=8;
final int MINIMUM_NUMBER_OF_DIGITS=2;
boolean validPassword=isLengthValid(password,LENGTH_OF_VALID_PASSWORD) && isOnlyLettersAndDigits(password) && hasNDigits(password,MINIMUM_NUMBER_OF_DIGITS);
return validPassword;
}
| Method isPasswordVaild tests whether a string is a valid password |
private synchronized void rebuildJournal() throws IOException {
if (journalWriter != null) {
journalWriter.close();
}
Writer writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(journalFileTmp),Util.US_ASCII));
try {
writer.write(MAGIC);
writer.write("\n");
writer.write(VERSION_1);
writer.write("\n");
writer.write(Integer.toString(appVersion));
writer.write("\n");
writer.write(Integer.toString(valueCount));
writer.write("\n");
writer.write("\n");
for ( Entry entry : lruEntries.values()) {
if (entry.currentEditor != null) {
writer.write(DIRTY + ' ' + entry.key+ '\n');
}
else {
writer.write(CLEAN + ' ' + entry.key+ entry.getLengths()+ '\n');
}
}
}
finally {
writer.close();
}
if (journalFile.exists()) {
renameTo(journalFile,journalFileBackup,true);
}
renameTo(journalFileTmp,journalFile,false);
journalFileBackup.delete();
journalWriter=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(journalFile,true),Util.US_ASCII));
}
| Creates a new journal that omits redundant information. This replaces the current journal if it exists. |
public static IsNullValue nullValue(){
return instanceByFlagsList[0][NULL];
}
| Get the instance representing values that are definitely null. |
public boolean voidIt(){
log.info("voidIt - " + toString());
m_processMsg=ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) return false;
if (!closeIt()) return false;
m_processMsg=ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) return false;
return true;
}
| Void Document. Same as Close. |
protected static Image loadFluffImageHeuristic(final Entity unit){
Image fluff=null;
String dir=DIR_NAME_MECH;
if (unit instanceof Aero) {
dir=DIR_NAME_AERO;
}
else if (unit instanceof BattleArmor) {
dir=DIR_NAME_BA;
}
else if (unit instanceof Tank) {
dir=DIR_NAME_VEHICLE;
}
File fluff_image_file=findFluffImage(new File(Configuration.fluffImagesDir(),dir),unit);
if (fluff_image_file != null) {
fluff=new ImageIcon(fluff_image_file.toString()).getImage();
}
return fluff;
}
| Attempt to load a fluff image by combining elements of type and name. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
Object obj=stack.pop();
if (obj == null) return null;
String s=obj.toString();
return (StringMatchUtils.convertFromNte(s));
}
| converts a string of NTE key characters (and normal characters) into their default character representation - given by the first character in the NTE chatacter list<br> The NTE key characters are the Unicode characters u2460-u2468 and u24EA (Unicode Circled Digits), representing the numeric Text Keys 1-9 and 0.<br> The characters represented by the keys are defined by the client properties <tt>"ui/numeric_text_input_<ui/translation_language_code>_<key>_lower</tt>. |
public void add(int id,String name,int parentId,int srvArchId,String srvArchName,int srvFdrId){
FolderTokenFdrLink link;
link=new FolderTokenFdrLink(id,name,parentId,srvArchId,srvArchName,srvFdrId);
super.add(link);
}
| Agrega un nuevo enlace a la lista |
@Mod.EventHandler public void preInit(FMLPreInitializationEvent e){
rftools=Loader.isModLoaded("rftools");
logger=e.getModLog();
mainConfigDir=e.getModConfigurationDirectory();
modConfigDir=new File(mainConfigDir.getPath() + File.separator + "deepresonance");
versionConfig=new Configuration(new File(modConfigDir,"version.cfg"));
config=new Configuration(new File(modConfigDir,"main.cfg"));
File machinesFile=new File(modConfigDir,"machines.cfg");
if (readVersionConfig()) {
try {
config.getConfigFile().delete();
machinesFile.delete();
}
catch ( Exception ee) {
FMLLog.log(Level.WARN,ee,"Could not reset config file!");
}
}
worldGridRegistry=new WorldGridRegistry();
networkHandler=new NetworkHandler(MODID);
compatHandler=new CompatHandler(config,logger);
compatHandler.addHandler(new ComputerCraftCompatHandler());
configWrapper=new ConfigWrapper(new Configuration(machinesFile));
configWrapper.registerConfigWithInnerClasses(new ConfigMachines());
configWrapper.refresh();
proxy.preInit(e);
MainCompatHandler.registerWaila();
MainCompatHandler.registerTOP();
if (rftools) {
Logging.log("Detected RFTools: enabling support");
FMLInterModComms.sendFunctionMessage("rftools","getScreenModuleRegistry","mcjty.deepresonance.items.rftoolsmodule.RFToolsSupport$GetScreenModuleRegistry");
}
}
| Run before anything else. Read your config, create blocks, items, etc, and register them with the GameRegistry. |
public static _Fields findByThriftIdOrThrow(int fieldId){
_Fields fields=findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
| Find the _Fields constant that matches fieldId, throwing an exception if it is not found. |
protected boolean isHTMLSupported(){
return htmlData != null;
}
| Should the HTML flavors be offered? If so, the method getHTMLData should be implemented to provide something reasonable. |
public WheelVerticalView(Context context,AttributeSet attrs){
this(context,attrs,R.attr.abstractWheelViewStyle);
}
| Create a new wheel vertical view. |
public static boolean isPrime(int number){
for (int divisor=2; divisor <= number / 2; divisor++) {
if (number % divisor == 0) {
return false;
}
}
return true;
}
| Check whether number is prime |
private AlarmEvent block(AlarmPoint alarm){
AlarmStatus status=alarm.currentStatus();
if (status.name(null).equals(AlarmPoint.STATUS_BLOCKED) || status.name(null).equals(AlarmPoint.STATUS_DISABLED)) {
return null;
}
AlarmStatus newStatus=createStatus(AlarmPoint.STATUS_BLOCKED);
return createEvent(alarm.identity().get(),status,newStatus,AlarmPoint.EVENT_BLOCKING);
}
| StateMachine change for block trigger. |
public void connectionUp(Connection con){
this.router.changedConnection(con);
}
| Informs the router of this host about state change in a connection object. |
public synchronized void ensureUpdated(){
}
| Should be invoked from the playback thread after the counters have been updated. Should also be invoked from any other thread that wishes to read the counters, before reading. These calls ensure that counter updates are made visible to the reading threads. |
protected void assertNumDocs(int expectedNumDocs,String collection) throws SolrServerException, IOException, InterruptedException {
CloudSolrClient client=createCloudClient(collection);
try {
int cnt=30;
AssertionError lastAssertionError=null;
while (cnt > 0) {
try {
assertEquals(expectedNumDocs,client.query(new SolrQuery("*:*")).getResults().getNumFound());
return;
}
catch ( AssertionError e) {
lastAssertionError=e;
cnt--;
Thread.sleep(500);
}
}
throw new AssertionError("Timeout while trying to assert number of documents @ " + collection,lastAssertionError);
}
finally {
client.close();
}
}
| Assert the number of documents in a given collection |
public VNXeCommandResult deleteConsistencyGroup(String cgId,boolean isForceSnapDeletion,boolean isForceVolumeDeletion){
if (isForceVolumeDeletion) {
DeleteStorageResourceRequest deleteReq=new DeleteStorageResourceRequest(_khClient);
return deleteReq.deleteLunGroup(cgId,isForceSnapDeletion);
}
else {
BlockLunRequests lunReq=new BlockLunRequests(_khClient);
List<VNXeLun> luns=lunReq.getLunsInLunGroup(cgId);
if (luns != null && !luns.isEmpty()) {
List<String> lunIds=new ArrayList<String>();
for ( VNXeLun lun : luns) {
lunIds.add(lun.getId());
}
removeLunsFromConsistencyGroup(cgId,lunIds);
}
DeleteStorageResourceRequest deleteReq=new DeleteStorageResourceRequest(_khClient);
return deleteReq.deleteLunGroup(cgId,isForceSnapDeletion);
}
}
| Delete Consistency group. if isForceVolumeDeletion is true, it would delete all the volumes in the Consistency group and the Consistency group. if isForceVolumeDeletion is false, it would remove all the volumes from the Consistency group, then delete the Consistency group. |
public void test_engineInit_01(){
KeyManagerFactorySpiImpl kmf=new KeyManagerFactorySpiImpl();
KeyStore ks;
char[] psw="password".toCharArray();
try {
kmf.engineInit(null,null);
fail("NoSuchAlgorithmException wasn't thrown");
}
catch ( NoSuchAlgorithmException kse) {
}
catch ( Exception e) {
fail(e + " was thrown instead of NoSuchAlgorithmException");
}
try {
kmf.engineInit(null,psw);
fail("KeyStoreException wasn't thrown");
}
catch ( KeyStoreException uke) {
}
catch ( Exception e) {
fail(e + " was thrown instead of KeyStoreException");
}
try {
ks=KeyStore.getInstance(KeyStore.getDefaultType());
kmf.engineInit(ks,null);
fail("UnrecoverableKeyException wasn't thrown");
}
catch ( UnrecoverableKeyException uke) {
}
catch ( Exception e) {
fail(e + " was thrown instead of UnrecoverableKeyException");
}
try {
KeyStore kst=KeyStore.getInstance(KeyStore.getDefaultType());
kst.load(null,null);
kmf.engineInit(kst,psw);
}
catch ( Exception e) {
fail("Unexpected exception " + e);
}
}
| javax.net.ssl.KeyManagerFactorySpi#KengineInit(KeyStore ks, char[] password) |
@Override public boolean index(Resource resource){
return false;
}
| Unused, not implemented |
public static int findPerceptuallyNearestColor(int rgb,int[] colors){
int nearestColor=0;
double closest=Double.MAX_VALUE;
float[] original=convertRGBtoLAB(rgb);
for (int i=0; i < colors.length; i++) {
float[] cl=convertRGBtoLAB(colors[i]);
double deltaE=calculateDeltaE(original[0],original[1],original[2],cl[0],cl[1],cl[2]);
if (deltaE < closest) {
nearestColor=colors[i];
closest=deltaE;
}
}
return nearestColor;
}
| Finds the "perceptually nearest" color from a list of colors to the given RGB value. This is done by converting to L*a*b colorspace and using the CIE2000 deltaE algorithm. |
@Override public boolean supportsConvert(int fromType,int toType){
if (isDebugEnabled()) {
debugCode("supportsConvert(" + fromType + ", "+ fromType+ ");");
}
return true;
}
| Returns whether CONVERT is supported for one datatype to another. |
public void remove(int childIndex){
MutableTreeNode child=(MutableTreeNode)getChildAt(childIndex);
children.removeElementAt(childIndex);
child.setParent(null);
}
| Removes the child at the specified index from this node's children and sets that node's parent to null. The child node to remove must be a <code>MutableTreeNode</code>. |
public void flushBase64() throws java.io.IOException {
if (position > 0) {
if (encode) {
out.write(encode3to4(b4,buffer,position));
position=0;
}
else {
throw new java.io.IOException("Base64 input not properly padded.");
}
}
}
| Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without closing the stream. |
private DisplayUtils(){
throw new Error("Do not need instantiate!");
}
| Don't let anyone instantiate this class. |
protected int bytesPerAtom(){
return (2);
}
| this clase encodes two bytes per atom |
protected Markup(final String agentId_){
this();
markupId=agentId_;
}
| Instantiates a new markup. |
public void removeAllTrackingIcons(){
iconArea.removeAllTrackingIcons();
}
| Removes all tracking icons. |
private void checkRoundTrip(WikibaseDate wbDate){
long seconds=wbDate.secondsSinceEpoch();
WikibaseDate roundDate=fromSecondsSinceEpoch(seconds);
assertEquals(wbDate,roundDate);
long roundSeconds=roundDate.secondsSinceEpoch();
assertEquals(seconds,roundSeconds);
String string=wbDate.toString(WIKIDATA);
roundDate=fromString(string);
assertEquals(wbDate,roundDate);
String roundString=roundDate.toString(WIKIDATA);
assertEquals(string,roundString);
string=wbDate.toString(DATE_TIME);
roundDate=fromString(string);
assertEquals(wbDate,roundDate);
roundString=roundDate.toString(DATE_TIME);
assertEquals(string,roundString);
string=wbDate.toString(DATE);
roundDate=fromString(string);
if (wbDate.hour() == 0 && wbDate.minute() == 0 && wbDate.second() == 0) {
assertEquals(wbDate,roundDate);
}
roundString=roundDate.toString(DATE);
assertEquals(string,roundString);
}
| Round trips the date through secondsSinceEpoch and all the toString and fromString formats. |
void parseTag() throws IOException {
Element elem;
boolean net=false;
boolean warned=false;
boolean unknown=false;
switch (ch=readCh()) {
case '!':
switch (ch=readCh()) {
case '-':
while (true) {
if (ch == '-') {
if (!strict || ((ch=readCh()) == '-')) {
ch=readCh();
if (!strict && ch == '-') {
ch=readCh();
}
if (textpos != 0) {
char newtext[]=new char[textpos];
System.arraycopy(text,0,newtext,0,textpos);
handleText(newtext);
lastBlockStartPos=currentBlockStartPos;
textpos=0;
}
parseComment();
last=makeTag(dtd.getElement("comment"),true);
handleComment(getChars(0));
continue;
}
else if (!warned) {
warned=true;
error("invalid.commentchar","-");
}
}
skipSpace();
switch (ch) {
case '-':
continue;
case '>':
ch=readCh();
case -1:
return;
default :
ch=readCh();
if (!warned) {
warned=true;
error("invalid.commentchar",String.valueOf((char)ch));
}
break;
}
}
default :
StringBuffer strBuff=new StringBuffer();
while (true) {
strBuff.append((char)ch);
if (parseMarkupDeclarations(strBuff)) {
return;
}
switch (ch) {
case '>':
ch=readCh();
case -1:
error("invalid.markup");
return;
case '\n':
ln++;
ch=readCh();
lfCount++;
break;
case '\r':
ln++;
if ((ch=readCh()) == '\n') {
ch=readCh();
crlfCount++;
}
else {
crCount++;
}
break;
default :
ch=readCh();
break;
}
}
}
case '/':
switch (ch=readCh()) {
case '>':
ch=readCh();
case '<':
if (recent == null) {
error("invalid.shortend");
return;
}
elem=recent;
break;
default :
if (!parseIdentifier(true)) {
error("expected.endtagname");
return;
}
skipSpace();
switch (ch) {
case '>':
ch=readCh();
case '<':
break;
default :
error("expected","'>'");
while ((ch != -1) && (ch != '\n') && (ch != '>')) {
ch=readCh();
}
if (ch == '>') {
ch=readCh();
}
break;
}
String elemStr=getString(0);
if (!dtd.elementExists(elemStr)) {
error("end.unrecognized",elemStr);
if ((textpos > 0) && (text[textpos - 1] == '\n')) {
textpos--;
}
elem=dtd.getElement("unknown");
elem.name=elemStr;
unknown=true;
}
else {
elem=dtd.getElement(elemStr);
}
break;
}
if (stack == null) {
error("end.extra.tag",elem.getName());
return;
}
if ((textpos > 0) && (text[textpos - 1] == '\n')) {
if (stack.pre) {
if ((textpos > 1) && (text[textpos - 2] != '\n')) {
textpos--;
}
}
else {
textpos--;
}
}
if (unknown) {
TagElement t=makeTag(elem);
handleText(t);
attributes.addAttribute(HTML.Attribute.ENDTAG,"true");
handleEmptyTag(makeTag(elem));
unknown=false;
return;
}
if (!strict) {
String stackElem=stack.elem.getName();
if (stackElem.equals("table")) {
if (!elem.getName().equals(stackElem)) {
error("tag.ignore",elem.getName());
return;
}
}
if (stackElem.equals("tr") || stackElem.equals("td")) {
if ((!elem.getName().equals("table")) && (!elem.getName().equals(stackElem))) {
error("tag.ignore",elem.getName());
return;
}
}
}
TagStack sp=stack;
while ((sp != null) && (elem != sp.elem)) {
sp=sp.next;
}
if (sp == null) {
error("unmatched.endtag",elem.getName());
return;
}
String elemName=elem.getName();
if (stack != sp && (elemName.equals("font") || elemName.equals("center"))) {
if (elemName.equals("center")) {
while (stack.elem.omitEnd() && stack != sp) {
endTag(true);
}
if (stack.elem == elem) {
endTag(false);
}
}
return;
}
while (stack != sp) {
endTag(true);
}
endTag(false);
return;
case -1:
error("eof");
return;
}
if (!parseIdentifier(true)) {
elem=recent;
if ((ch != '>') || (elem == null)) {
error("expected.tagname");
return;
}
}
else {
String elemStr=getString(0);
if (elemStr.equals("image")) {
elemStr="img";
}
if (!dtd.elementExists(elemStr)) {
error("tag.unrecognized ",elemStr);
elem=dtd.getElement("unknown");
elem.name=elemStr;
unknown=true;
}
else {
elem=dtd.getElement(elemStr);
}
}
parseAttributeSpecificationList(elem);
switch (ch) {
case '/':
net=true;
case '>':
ch=readCh();
if (ch == '>' && net) {
ch=readCh();
}
case '<':
break;
default :
error("expected","'>'");
break;
}
if (!strict) {
if (elem.getName().equals("script")) {
error("javascript.unsupported");
}
}
if (!elem.isEmpty()) {
if (ch == '\n') {
ln++;
lfCount++;
ch=readCh();
}
else if (ch == '\r') {
ln++;
if ((ch=readCh()) == '\n') {
ch=readCh();
crlfCount++;
}
else {
crCount++;
}
}
}
TagElement tag=makeTag(elem,false);
if (!unknown) {
legalTagContext(tag);
if (!strict && skipTag) {
skipTag=false;
return;
}
}
startTag(tag);
if (!elem.isEmpty()) {
switch (elem.getType()) {
case CDATA:
parseLiteral(false);
break;
case RCDATA:
parseLiteral(true);
break;
default :
if (stack != null) {
stack.net=net;
}
break;
}
}
}
| Parse a start or end tag. |
public ECHO384(){
super();
}
| Create the engine. |
protected OperationSourceImpl(){
super();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void push(EventQueue newEventQueue){
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
getEventLog().fine("EventQueue.push(" + newEventQueue + ")");
}
pushPopLock.lock();
try {
EventQueue topQueue=this;
while (topQueue.nextQueue != null) {
topQueue=topQueue.nextQueue;
}
if (topQueue.fwDispatcher != null) {
throw new RuntimeException("push() to queue with fwDispatcher");
}
if ((topQueue.dispatchThread != null) && (topQueue.dispatchThread.getEventQueue() == this)) {
newEventQueue.dispatchThread=topQueue.dispatchThread;
topQueue.dispatchThread.setEventQueue(newEventQueue);
}
while (topQueue.peekEvent() != null) {
try {
newEventQueue.postEventPrivate(topQueue.getNextEventPrivate());
}
catch ( InterruptedException ie) {
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
getEventLog().fine("Interrupted push",ie);
}
}
}
if (topQueue.dispatchThread != null) {
topQueue.postEventPrivate(new InvocationEvent(topQueue,dummyRunnable));
}
newEventQueue.previousQueue=topQueue;
topQueue.nextQueue=newEventQueue;
if (appContext.get(AppContext.EVENT_QUEUE_KEY) == topQueue) {
appContext.put(AppContext.EVENT_QUEUE_KEY,newEventQueue);
}
pushPopCond.signalAll();
}
finally {
pushPopLock.unlock();
}
}
| Replaces the existing <code>EventQueue</code> with the specified one. Any pending events are transferred to the new <code>EventQueue</code> for processing by it. |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:04.513 -0500",hash_original_method="EBAE74DC80F9C6BC38A9630AD570AE77",hash_generated_method="A44B995D98502C226FF53B0B869781E4") public ServiceConfigurationError(String message){
super(message);
}
| Constructs a new error with the given detail message. |
public LayerTreeNode(Layer layer){
super(layer != null ? layer.getName() : "");
if (layer == null) {
String message=Logging.getMessage("nullValue.LayerIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.layer=layer;
this.initialize();
}
| Creates a new <code>LayerTreeNode</code> from the specified <code>layer</code>. The node's name is set to the layer's name. |
public boolean isPersist(){
return persist;
}
| Gets the value of the persist property. |
public static void deleteSection(final SQLProvider provider,final Section section) throws CouldntLoadDataException {
Preconditions.checkNotNull(provider,"Error: provider argument can not be null");
Preconditions.checkNotNull(section,"Error: section argument can not be null");
final String query=" { call delete_section(?, ?) } ";
try (CallableStatement procedure=provider.getConnection().getConnection().prepareCall(query)){
procedure.setInt(1,section.getModule().getConfiguration().getId());
procedure.setInt(2,section.getId());
procedure.execute();
}
catch ( final SQLException exception) {
throw new CouldntLoadDataException(exception);
}
}
| Deletes a section from the database. |
public Matrix invert(){
if (rows != columns) {
throw new IllegalArgumentException("Only square matrices can be inverted");
}
Matrix work=augment(identity(rows));
work.gaussianElimination();
return work.submatrix(0,rows,columns,columns * 2);
}
| Returns the inverse of this matrix. |
protected boolean readRecords(DataInputStream is) throws IOException {
short functionId=1;
int recSize=0;
short recData;
numRecords=0;
while (functionId > 0) {
recSize=readInt(is);
recSize-=3;
functionId=readShort(is);
if (functionId <= 0) break;
MetaRecord mr=new MetaRecord();
switch (functionId) {
case WMFConstants.META_SETMAPMODE:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int mapmode=readShort(is);
if (mapmode == WMFConstants.MM_ANISOTROPIC) isotropic=false;
mr.addElement(mapmode);
records.add(mr);
}
break;
case WMFConstants.META_DRAWTEXT:
{
for (int i=0; i < recSize; i++) recData=readShort(is);
numRecords--;
}
break;
case WMFConstants.META_EXTTEXTOUT:
{
int yVal=readShort(is) * ySign;
int xVal=(int)(readShort(is) * xSign * scaleXY);
int lenText=readShort(is);
int flag=readShort(is);
int read=4;
boolean clipped=false;
int x1=0, y1=0, x2=0, y2=0;
int len;
if ((flag & WMFConstants.ETO_CLIPPED) != 0) {
x1=(int)(readShort(is) * xSign * scaleXY);
y1=readShort(is) * ySign;
x2=(int)(readShort(is) * xSign * scaleXY);
y2=readShort(is) * ySign;
read+=4;
clipped=true;
}
byte[] bstr=new byte[lenText];
int i=0;
for (; i < lenText; i++) {
bstr[i]=is.readByte();
}
read+=(lenText + 1) / 2;
if (lenText % 2 != 0) is.readByte();
if (read < recSize) for (int j=read; j < recSize; j++) readShort(is);
mr=new MetaRecord.ByteRecord(bstr);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(xVal);
mr.addElement(yVal);
mr.addElement(flag);
if (clipped) {
mr.addElement(x1);
mr.addElement(y1);
mr.addElement(x2);
mr.addElement(y2);
}
records.add(mr);
}
break;
case WMFConstants.META_TEXTOUT:
{
int len=readShort(is);
int read=1;
byte[] bstr=new byte[len];
for (int i=0; i < len; i++) {
bstr[i]=is.readByte();
}
if (len % 2 != 0) is.readByte();
read+=(len + 1) / 2;
int yVal=readShort(is) * ySign;
int xVal=(int)(readShort(is) * xSign * scaleXY);
read+=2;
if (read < recSize) for (int j=read; j < recSize; j++) readShort(is);
mr=new MetaRecord.ByteRecord(bstr);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(xVal);
mr.addElement(yVal);
records.add(mr);
}
break;
case WMFConstants.META_CREATEFONTINDIRECT:
{
int lfHeight=readShort(is);
int lfWidth=readShort(is);
int lfEscapement=readShort(is);
int lfOrientation=readShort(is);
int lfWeight=readShort(is);
int lfItalic=is.readByte();
int lfUnderline=is.readByte();
int lfStrikeOut=is.readByte();
int lfCharSet=is.readByte() & 0x00ff;
int lfOutPrecision=is.readByte();
int lfClipPrecision=is.readByte();
int lfQuality=is.readByte();
int lfPitchAndFamily=is.readByte();
int len=(2 * (recSize - 9));
byte[] lfFaceName=new byte[len];
byte ch;
for (int i=0; i < len; i++) lfFaceName[i]=is.readByte();
String str=new String(lfFaceName);
mr=new MetaRecord.StringRecord(str);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(lfHeight);
mr.addElement(lfItalic);
mr.addElement(lfWeight);
mr.addElement(lfCharSet);
mr.addElement(lfUnderline);
mr.addElement(lfStrikeOut);
mr.addElement(lfOrientation);
mr.addElement(lfEscapement);
records.add(mr);
}
break;
case WMFConstants.META_SETVIEWPORTORG:
case WMFConstants.META_SETVIEWPORTEXT:
case WMFConstants.META_SETWINDOWORG:
case WMFConstants.META_SETWINDOWEXT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int height=readShort(is);
int width=readShort(is);
if (width < 0) {
width=-width;
xSign=-1;
}
if (height < 0) {
height=-height;
ySign=-1;
}
mr.addElement((int)(width * scaleXY));
mr.addElement(height);
records.add(mr);
if (_bext && functionId == WMFConstants.META_SETWINDOWEXT) {
vpW=width;
vpH=height;
if (!isotropic) scaleXY=(float)vpW / (float)vpH;
vpW=(int)(vpW * scaleXY);
_bext=false;
}
if (!isAldus) {
this.width=vpW;
this.height=vpH;
}
}
break;
case WMFConstants.META_OFFSETVIEWPORTORG:
case WMFConstants.META_OFFSETWINDOWORG:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int y=readShort(is) * ySign;
int x=(int)(readShort(is) * xSign * scaleXY);
mr.addElement(x);
mr.addElement(y);
records.add(mr);
}
break;
case WMFConstants.META_SCALEVIEWPORTEXT:
case WMFConstants.META_SCALEWINDOWEXT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int ydenom=readShort(is);
int ynum=readShort(is);
int xdenom=readShort(is);
int xnum=readShort(is);
mr.addElement(xdenom);
mr.addElement(ydenom);
mr.addElement(xnum);
mr.addElement(ynum);
records.add(mr);
scaleX=scaleX * (float)xdenom / (float)xnum;
scaleY=scaleY * (float)ydenom / (float)ynum;
}
break;
case WMFConstants.META_CREATEBRUSHINDIRECT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(readShort(is));
int colorref=readInt(is);
int red=colorref & 0xff;
int green=(colorref & 0xff00) >> 8;
int blue=(colorref & 0xff0000) >> 16;
int flags=(colorref & 0x3000000) >> 24;
mr.addElement(red);
mr.addElement(green);
mr.addElement(blue);
mr.addElement(readShort(is));
records.add(mr);
}
break;
case WMFConstants.META_CREATEPENINDIRECT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(readShort(is));
int width=readInt(is);
int colorref=readInt(is);
if (recSize == 6) readShort(is);
int red=colorref & 0xff;
int green=(colorref & 0xff00) >> 8;
int blue=(colorref & 0xff0000) >> 16;
int flags=(colorref & 0x3000000) >> 24;
mr.addElement(red);
mr.addElement(green);
mr.addElement(blue);
mr.addElement(width);
records.add(mr);
}
break;
case WMFConstants.META_SETTEXTALIGN:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int align=readShort(is);
if (recSize > 1) for (int i=1; i < recSize; i++) readShort(is);
mr.addElement(align);
records.add(mr);
}
break;
case WMFConstants.META_SETTEXTCOLOR:
case WMFConstants.META_SETBKCOLOR:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int colorref=readInt(is);
int red=colorref & 0xff;
int green=(colorref & 0xff00) >> 8;
int blue=(colorref & 0xff0000) >> 16;
int flags=(colorref & 0x3000000) >> 24;
mr.addElement(red);
mr.addElement(green);
mr.addElement(blue);
records.add(mr);
}
break;
case WMFConstants.META_LINETO:
case WMFConstants.META_MOVETO:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int y=readShort(is) * ySign;
int x=(int)(readShort(is) * xSign * scaleXY);
mr.addElement(x);
mr.addElement(y);
records.add(mr);
}
break;
case WMFConstants.META_SETPOLYFILLMODE:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int mode=readShort(is);
if (recSize > 1) for (int i=1; i < recSize; i++) readShort(is);
mr.addElement(mode);
records.add(mr);
}
break;
case WMFConstants.META_POLYPOLYGON:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int count=readShort(is);
int[] pts=new int[count];
int ptCount=0;
for (int i=0; i < count; i++) {
pts[i]=readShort(is);
ptCount+=pts[i];
}
mr.addElement(count);
for (int i=0; i < count; i++) mr.addElement(pts[i]);
int offset=count + 1;
for (int i=0; i < count; i++) {
int nPoints=pts[i];
for (int j=0; j < nPoints; j++) {
mr.addElement((int)(readShort(is) * xSign * scaleXY));
mr.addElement(readShort(is) * ySign);
}
}
records.add(mr);
}
break;
case WMFConstants.META_POLYLINE:
case WMFConstants.META_POLYGON:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int count=readShort(is);
mr.addElement(count);
for (int i=0; i < count; i++) {
mr.addElement((int)(readShort(is) * xSign * scaleXY));
mr.addElement(readShort(is) * ySign);
}
records.add(mr);
}
break;
case WMFConstants.META_ELLIPSE:
case WMFConstants.META_INTERSECTCLIPRECT:
case WMFConstants.META_RECTANGLE:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int bottom=readShort(is) * ySign;
int right=(int)(readShort(is) * xSign * scaleXY);
int top=readShort(is) * ySign;
int left=(int)(readShort(is) * xSign * scaleXY);
mr.addElement(left);
mr.addElement(top);
mr.addElement(right);
mr.addElement(bottom);
records.add(mr);
}
break;
case WMFConstants.META_CREATEREGION:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int left=(int)(readShort(is) * xSign * scaleXY);
int top=readShort(is) * ySign;
int right=(int)(readShort(is) * xSign * scaleXY);
int bottom=readShort(is) * ySign;
mr.addElement(left);
mr.addElement(top);
mr.addElement(right);
mr.addElement(bottom);
records.add(mr);
}
break;
case WMFConstants.META_ROUNDRECT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int el_height=readShort(is) * ySign;
int el_width=(int)(readShort(is) * xSign * scaleXY);
int bottom=readShort(is) * ySign;
int right=(int)(readShort(is) * xSign * scaleXY);
int top=readShort(is) * ySign;
int left=(int)(readShort(is) * xSign * scaleXY);
mr.addElement(left);
mr.addElement(top);
mr.addElement(right);
mr.addElement(bottom);
mr.addElement(el_width);
mr.addElement(el_height);
records.add(mr);
}
break;
case WMFConstants.META_ARC:
case WMFConstants.META_PIE:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int yend=readShort(is) * ySign;
int xend=(int)(readShort(is) * xSign * scaleXY);
int ystart=readShort(is) * ySign;
int xstart=(int)(readShort(is) * xSign * scaleXY);
int bottom=readShort(is) * ySign;
int right=(int)(readShort(is) * xSign * scaleXY);
int top=readShort(is) * ySign;
int left=(int)(readShort(is) * xSign * scaleXY);
mr.addElement(left);
mr.addElement(top);
mr.addElement(right);
mr.addElement(bottom);
mr.addElement(xstart);
mr.addElement(ystart);
mr.addElement(xend);
mr.addElement(yend);
records.add(mr);
}
break;
case WMFConstants.META_PATBLT:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int rop=readInt(is);
int height=readShort(is) * ySign;
int width=(int)(readShort(is) * xSign * scaleXY);
int left=(int)(readShort(is) * xSign * scaleXY);
int top=readShort(is) * ySign;
mr.addElement(rop);
mr.addElement(height);
mr.addElement(width);
mr.addElement(top);
mr.addElement(left);
records.add(mr);
}
break;
case WMFConstants.META_SETBKMODE:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int mode=readShort(is);
mr.addElement(mode);
if (recSize > 1) for (int i=1; i < recSize; i++) readShort(is);
records.add(mr);
}
break;
case WMFConstants.META_SETROP2:
{
mr.numPoints=recSize;
mr.functionId=functionId;
int rop;
if (recSize == 1) rop=readShort(is);
else rop=readInt(is);
mr.addElement(rop);
records.add(mr);
}
break;
case WMFConstants.META_DIBSTRETCHBLT:
{
int mode=is.readInt() & 0xff;
int heightSrc=readShort(is) * ySign;
int widthSrc=readShort(is) * xSign;
int sy=readShort(is) * ySign;
int sx=readShort(is) * xSign;
int heightDst=readShort(is) * ySign;
int widthDst=(int)(readShort(is) * xSign * scaleXY);
int dy=readShort(is) * ySign;
int dx=(int)(readShort(is) * xSign * scaleXY);
int len=2 * recSize - 20;
byte[] bitmap=new byte[len];
for (int i=0; i < len; i++) bitmap[i]=is.readByte();
mr=new MetaRecord.ByteRecord(bitmap);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(mode);
mr.addElement(heightSrc);
mr.addElement(widthSrc);
mr.addElement(sy);
mr.addElement(sx);
mr.addElement(heightDst);
mr.addElement(widthDst);
mr.addElement(dy);
mr.addElement(dx);
records.add(mr);
}
break;
case WMFConstants.META_STRETCHDIB:
{
int mode=is.readInt() & 0xff;
int usage=readShort(is);
int heightSrc=readShort(is) * ySign;
int widthSrc=readShort(is) * xSign;
int sy=readShort(is) * ySign;
int sx=readShort(is) * xSign;
int heightDst=readShort(is) * ySign;
int widthDst=(int)(readShort(is) * xSign * scaleXY);
int dy=readShort(is) * ySign;
int dx=(int)(readShort(is) * xSign * scaleXY);
int len=2 * recSize - 22;
byte bitmap[]=new byte[len];
for (int i=0; i < len; i++) bitmap[i]=is.readByte();
mr=new MetaRecord.ByteRecord(bitmap);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(mode);
mr.addElement(heightSrc);
mr.addElement(widthSrc);
mr.addElement(sy);
mr.addElement(sx);
mr.addElement(heightDst);
mr.addElement(widthDst);
mr.addElement(dy);
mr.addElement(dx);
records.add(mr);
}
break;
case WMFConstants.META_DIBBITBLT:
{
int mode=is.readInt() & 0xff;
int sy=readShort(is);
int sx=readShort(is);
int hdc=readShort(is);
int height=readShort(is);
int width=(int)(readShort(is) * xSign * scaleXY);
int dy=readShort(is);
int dx=(int)(readShort(is) * xSign * scaleXY);
int len=2 * recSize - 18;
if (len > 0) {
byte[] bitmap=new byte[len];
for (int i=0; i < len; i++) bitmap[i]=is.readByte();
mr=new MetaRecord.ByteRecord(bitmap);
mr.numPoints=recSize;
mr.functionId=functionId;
}
else {
mr.numPoints=recSize;
mr.functionId=functionId;
for (int i=0; i < len; i++) is.readByte();
}
mr.addElement(mode);
mr.addElement(height);
mr.addElement(width);
mr.addElement(sy);
mr.addElement(sx);
mr.addElement(dy);
mr.addElement(dx);
records.add(mr);
}
break;
case WMFConstants.META_DIBCREATEPATTERNBRUSH:
{
int type=is.readInt() & 0xff;
int len=2 * recSize - 4;
byte[] bitmap=new byte[len];
for (int i=0; i < len; i++) bitmap[i]=is.readByte();
mr=new MetaRecord.ByteRecord(bitmap);
mr.numPoints=recSize;
mr.functionId=functionId;
mr.addElement(type);
records.add(mr);
}
break;
default :
mr.numPoints=recSize;
mr.functionId=functionId;
for (int j=0; j < recSize; j++) mr.addElement(readShort(is));
records.add(mr);
break;
}
numRecords++;
}
if (!isAldus) {
right=(int)vpX;
left=(int)(vpX + vpW);
top=(int)vpY;
bottom=(int)(vpY + vpH);
}
setReading(false);
return true;
}
| Reads the WMF file from the specified Stream. |
public void addStreamHost(final StreamHost host){
streamHosts.add(host);
}
| Adds a potential stream host that the remote user can transfer the file through. |
public MessageBuilder appendContent(String content,Styles styles){
this.content+=(styles.getMarkdown() + content + styles.getReverseMarkdown());
return this;
}
| Appends extra text to the current content with given style. |
protected final void fireVetoableChange(String propertyName,long oldValue,long newValue) throws PropertyVetoException {
fireVetoableChange(propertyName,Long.valueOf(oldValue),Long.valueOf(newValue));
}
| Support for reporting changes for constrained integer properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners. |
public void push(final float value){
int bits=Float.floatToIntBits(value);
if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) {
mv.visitInsn(Opcodes.FCONST_0 + (int)value);
}
else {
mv.visitLdcInsn(value);
}
}
| Generates the instruction to push the given value on the stack. |
public DGeneralSubtreeChooser(JFrame parent,String title,GeneralSubtree generalSubtree){
super(parent,title,ModalityType.DOCUMENT_MODAL);
initComponents(generalSubtree);
}
| Constructs a new DGeneralSubtreeChooser dialog. |
public static void resumeEventStream(Context context){
Log.d(LOG_TAG,"resumeEventStream");
sendEventStreamAction(context,EventStreamService.StreamAction.RESUME);
}
| Resume the events stream |
public void testNewClassLoaderHotRedeploymentPrivateMode() throws Exception {
processTestClassLoaderHotRedeployment(DeploymentMode.PRIVATE);
}
| Test GridDeploymentMode.ISOLATED mode. |
public FixedByteArrayBuffer(final byte[] buf,final int off,final int len){
super(off,len);
if (buf == null) throw new IllegalArgumentException("buf");
if (off + len > buf.length) throw new IllegalArgumentException("off+len>buf.length");
this.buf=buf;
}
| Create a slice of a byte[]. |
public ConnPoolByRoute(final ClientConnectionOperator operator,final HttpParams params){
super();
if (operator == null) {
throw new IllegalArgumentException("Connection operator may not be null");
}
this.operator=operator;
freeConnections=createFreeConnQueue();
waitingThreads=createWaitingThreadQueue();
routeToPool=createRouteToPoolMap();
maxTotalConnections=ConnManagerParams.getMaxTotalConnections(params);
connPerRoute=ConnManagerParams.getMaxConnectionsPerRoute(params);
}
| Creates a new connection pool, managed by route. |
public td[] addWindowFooters(){
if (m_table == null) return null;
td left=new td("windowFooter",AlignType.LEFT,AlignType.MIDDLE,false);
td right=new td("windowFooter",AlignType.RIGHT,AlignType.MIDDLE,false);
m_table.addElement(new tr().addElement(left).addElement(right));
return new td[]{left,right};
}
| Add Window Footer |
public static void initThreadsFlag(CFlags flags){
flags.registerOptional('T',THREADS_FLAG,Integer.class,INT,"number of threads (Default is the number of available cores)").setCategory(CommonFlagCategories.UTILITY);
}
| initialize flag to read number of threads. |
static final public Object deserialize(final byte[] b,final int off,final int len){
final ByteArrayInputStream bais=new ByteArrayInputStream(b,off,len);
try {
final ObjectInputStream ois=new ObjectInputStream(bais);
return ois.readObject();
}
catch ( Exception ex) {
throw new RuntimeException("off=" + off + ", len="+ len,ex);
}
}
| De-serialize an object using the Java serialization mechanisms. |
private <ElementType extends Element>Iterator<? extends ElementType> elements(BiFunction<OrientGraph,Object[],Iterator<ElementType>> getElementsByIds,TriFunction<OrientGraph,OIndex<Object>,Iterator<Object>,Stream<? extends ElementType>> getElementsByIndex,Function<OrientGraph,Iterator<ElementType>> getAllElements){
final OrientGraph graph=getGraph();
if (this.ids != null && this.ids.length > 0) {
return this.iteratorList(getElementsByIds.apply(graph,this.ids));
}
else {
Set<OrientIndexQuery> indexQueryOptions=findIndex();
if (!indexQueryOptions.isEmpty()) {
List<ElementType> elements=new ArrayList<>();
indexQueryOptions.forEach(null);
return elements.iterator();
}
else {
OLogManager.instance().warn(this,"scanning through all elements without using an index for Traversal " + getTraversal());
return this.iteratorList(getAllElements.apply(graph));
}
}
}
| Gets an iterator over those vertices/edges that have the specific IDs wanted, or those that have indexed properties with the wanted values, or failing that by just getting all of the vertices or edges. |
public boolean createClient(String clientName,String orgValue,String orgName,String userClient,String userOrg,String phone,String phone2,String fax,String eMail,String taxID,String DUNS,String logoFile,int Country_ID){
log.info(clientName);
m_trx.start();
m_info=new StringBuffer();
String name=null;
String sql=null;
int no=0;
name=clientName;
if (name == null || name.length() == 0) name="newClient";
m_clientName=name;
m_client=new MClient(m_ctx,0,true,m_trx.getTrxName());
m_client.setValue(m_clientName);
m_client.setName(m_clientName);
m_client.setIsUseBetaFunctions(false);
m_client.setIsCostImmediate(true);
m_client.setAutoArchive(MClient.AUTOARCHIVE_ExternalDocuments);
MCountry country=MCountry.get(m_ctx,Country_ID);
if (country.getAD_Language() != null) m_client.setAD_Language(country.getAD_Language());
if (!m_client.save()) {
String err="Client NOT created";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
int AD_Client_ID=m_client.getAD_Client_ID();
Env.setContext(m_ctx,m_WindowNo,"AD_Client_ID",AD_Client_ID);
Env.setContext(m_ctx,"#AD_Client_ID",AD_Client_ID);
m_stdValues=String.valueOf(AD_Client_ID) + ",0,'Y',SysDate,0,SysDate,0";
m_info.append(Msg.translate(m_lang,"AD_Client_ID")).append("=").append(name).append("\n");
if (!MSequence.checkClientSequences(m_ctx,AD_Client_ID,m_trx.getTrxName())) {
String err="Sequences NOT created";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
if (!m_client.setupClientInfo(m_lang)) {
String err="Client Info NOT created";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
m_AD_Tree_Account_ID=m_client.getSetup_AD_Tree_Account_ID();
name=orgName;
if (name == null || name.length() == 0) name="newOrg";
if (orgValue == null || orgValue.length() == 0) orgValue=name;
m_org=new MOrg(m_client,orgValue,name);
if (!m_org.save()) {
String err="Organization NOT created";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
Env.setContext(m_ctx,m_WindowNo,"AD_Org_ID",getAD_Org_ID());
Env.setContext(m_ctx,"#AD_Org_ID",getAD_Org_ID());
m_stdValuesOrg=AD_Client_ID + "," + getAD_Org_ID()+ ",'Y',SysDate,0,SysDate,0";
m_info.append(Msg.translate(m_lang,"AD_Org_ID")).append("=").append(name).append("\n");
MOrgInfo orgInfo=MOrgInfo.get(m_ctx,getAD_Org_ID(),m_trx.getTrxName());
orgInfo.setPhone(phone);
orgInfo.setPhone2(phone2);
orgInfo.setFax(fax);
orgInfo.setEMail(eMail);
if (taxID != null && taxID.length() > 0) {
orgInfo.setTaxID(taxID);
}
if (!Util.isEmpty(DUNS)) orgInfo.setDUNS(DUNS);
if (!Util.isEmpty(logoFile)) {
byte[] data=null;
File file=new File(logoFile);
try {
FileInputStream fis=new FileInputStream(file);
ByteArrayOutputStream os=new ByteArrayOutputStream();
byte[] buffer=new byte[1024 * 8];
int length=-1;
while ((length=fis.read(buffer)) != -1) os.write(buffer,0,length);
fis.close();
data=os.toByteArray();
os.close();
MImage logo=new MImage(m_ctx,0,m_trx.getTrxName());
logo.setName(file.getName());
logo.setImageURL(file.getPath());
logo.setBinaryData(data);
logo.saveEx();
MClientInfo clientInfo=m_client.getInfo();
if (clientInfo != null) {
clientInfo.setLogo_ID(logo.getAD_Image_ID());
clientInfo.saveEx(m_trx.getTrxName());
}
}
catch ( Exception e) {
log.log(Level.WARNING,"Failed to load logo image",e);
}
}
if (!orgInfo.save()) {
String err="Organization Info NOT Updated";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
name=m_clientName + " Admin";
MRole admin=new MRole(m_ctx,0,m_trx.getTrxName());
admin.setClientOrg(m_client);
admin.setName(name);
admin.setUserLevel(MRole.USERLEVEL_ClientPlusOrganization);
admin.setPreferenceType(MRole.PREFERENCETYPE_Client);
admin.setIsShowAcct(true);
if (!admin.save()) {
String err="Admin Role A NOT inserted";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
MRoleOrgAccess adminClientAccess=new MRoleOrgAccess(admin,0);
if (!adminClientAccess.save()) log.log(Level.SEVERE,"Admin Role_OrgAccess 0 NOT created");
MRoleOrgAccess adminOrgAccess=new MRoleOrgAccess(admin,m_org.getAD_Org_ID());
if (!adminOrgAccess.save()) log.log(Level.SEVERE,"Admin Role_OrgAccess NOT created");
m_info.append(Msg.translate(m_lang,"AD_Role_ID")).append("=").append(name).append("\n");
name=m_clientName + " User";
MRole user=new MRole(m_ctx,0,m_trx.getTrxName());
user.setClientOrg(m_client);
user.setName(name);
if (!user.save()) {
String err="User Role A NOT inserted";
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
MRoleOrgAccess userOrgAccess=new MRoleOrgAccess(user,m_org.getAD_Org_ID());
if (!userOrgAccess.save()) log.log(Level.SEVERE,"User Role_OrgAccess NOT created");
m_info.append(Msg.translate(m_lang,"AD_Role_ID")).append("=").append(name).append("\n");
name=userClient;
if (name == null || name.length() == 0) name=m_clientName + "Client";
AD_User_ID=getNextID(AD_Client_ID,"AD_User");
AD_User_Name=name;
name=DB.TO_STRING(name);
sql="INSERT INTO AD_User(" + m_stdColumns + ",AD_User_ID,"+ "Name,Description,Password)"+ " VALUES ("+ m_stdValues+ ","+ AD_User_ID+ ","+ name+ ","+ name+ ","+ name+ ")";
no=DB.executeUpdate(sql,m_trx.getTrxName());
if (no != 1) {
String err="Admin User NOT inserted - " + AD_User_Name;
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
m_info.append(Msg.translate(m_lang,"AD_User_ID")).append("=").append(AD_User_Name).append("/").append(AD_User_Name).append("\n");
name=userOrg;
if (name == null || name.length() == 0) name=m_clientName + "Org";
AD_User_U_ID=getNextID(AD_Client_ID,"AD_User");
AD_User_U_Name=name;
name=DB.TO_STRING(name);
sql="INSERT INTO AD_User(" + m_stdColumns + ",AD_User_ID,"+ "Name,Description,Password)"+ " VALUES ("+ m_stdValues+ ","+ AD_User_U_ID+ ","+ name+ ","+ name+ ","+ name+ ")";
no=DB.executeUpdate(sql,m_trx.getTrxName());
if (no != 1) {
String err="Org User NOT inserted - " + AD_User_U_Name;
log.log(Level.SEVERE,err);
m_info.append(err);
m_trx.rollback();
m_trx.close();
return false;
}
m_info.append(Msg.translate(m_lang,"AD_User_ID")).append("=").append(AD_User_U_Name).append("/").append(AD_User_U_Name).append("\n");
sql="INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"+ " VALUES ("+ m_stdValues+ ","+ AD_User_ID+ ","+ admin.getAD_Role_ID()+ ")";
no=DB.executeUpdate(sql,m_trx.getTrxName());
if (no != 1) log.log(Level.SEVERE,"UserRole ClientUser+Admin NOT inserted");
sql="INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"+ " VALUES ("+ m_stdValues+ ","+ AD_User_ID+ ","+ user.getAD_Role_ID()+ ")";
no=DB.executeUpdate(sql,m_trx.getTrxName());
if (no != 1) log.log(Level.SEVERE,"UserRole ClientUser+User NOT inserted");
sql="INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"+ " VALUES ("+ m_stdValues+ ","+ AD_User_U_ID+ ","+ user.getAD_Role_ID()+ ")";
no=DB.executeUpdate(sql,m_trx.getTrxName());
if (no != 1) log.log(Level.SEVERE,"UserRole OrgUser+Org NOT inserted");
MAcctProcessor ap=new MAcctProcessor(m_client,AD_User_ID);
ap.saveEx();
MRequestProcessor rp=new MRequestProcessor(m_client,AD_User_ID);
rp.saveEx();
log.info("fini");
return true;
}
| Create Client Info. - Client, Trees, Org, Role, User, User_Role |
@Override public void executeAction(Agent agent,Action action){
if (action instanceof QueenAction) {
QueenAction act=(QueenAction)action;
XYLocation loc=new XYLocation(act.getX(),act.getY());
if (act.getName() == QueenAction.PLACE_QUEEN) board.addQueenAt(loc);
else if (act.getName() == QueenAction.REMOVE_QUEEN) board.removeQueenFrom(loc);
else if (act.getName() == QueenAction.MOVE_QUEEN) board.moveQueenTo(loc);
if (agent == null) updateEnvironmentViewsAgentActed(agent,action);
}
}
| Executes the provided action and returns null. |
public SearchRequest scroll(TimeValue keepAlive){
return scroll(new Scroll(keepAlive));
}
| If set, will enable scrolling of the search request for the specified timeout. |
public TaskList activateFullCopy(URI sourceURI,URI fullCopyURI) throws InternalException {
s_logger.info("START activate full copy {}",fullCopyURI);
Map<URI,BlockObject> resourceMap=BlockFullCopyUtils.verifySourceAndFullCopy(sourceURI,fullCopyURI,_uriInfo,_dbClient);
BlockObject fcSourceObj=resourceMap.get(sourceURI);
Volume fullCopyVolume=(Volume)resourceMap.get(fullCopyURI);
if (BlockFullCopyUtils.isFullCopyDetached(fullCopyVolume,_dbClient)) {
throw APIException.badRequests.detachedFullCopyCannotBeActivated(fullCopyURI.toString());
}
boolean alreadyActive=!BlockFullCopyUtils.isFullCopyInactive(fullCopyVolume,_dbClient);
BlockFullCopyApi fullCopyApiImpl=getPlatformSpecificFullCopyImpl(fullCopyVolume);
TaskList taskList=fullCopyApiImpl.activate(fcSourceObj,fullCopyVolume);
if (!alreadyActive) {
auditOp(OperationTypeEnum.ACTIVATE_VOLUME_FULL_COPY,true,AuditLogManager.AUDITOP_BEGIN,fullCopyURI);
}
s_logger.info("FINISH activate full copy {}",fullCopyURI);
return taskList;
}
| Manages the activation of the full copy with the passed URI for the source with the passed URI. For supported platforms, if the source is a volume and the volume is part of a consistency group, this method will also activate the corresponding full copies for all other volumes in the consistency group. |
@OnError public void onError(Session session,Throwable t){
callInternal("onError",session,t.getMessage());
logger.error(t.getMessage(),t);
}
| On error raised handler |
public boolean contains(char ch){
char[] thisBuf=buffer;
for (int i=0; i < this.size; i++) {
if (thisBuf[i] == ch) {
return true;
}
}
return false;
}
| Checks if the string builder contains the specified char. |
private void initKeyboardButtons(KeyboardView view){
mButtons=new ArrayList<>();
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_0));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_1));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_2));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_3));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_4));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_5));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_6));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_7));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_8));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_9));
mButtons.add((KeyboardButtonView)view.findViewById(R.id.pin_code_button_clear));
for ( View button : mButtons) {
button.setOnClickListener(this);
}
}
| Init the keyboard buttons (onClickListener) |
protected AssociationRequest(AssociationSessionType type,DiffieHellmanSession dhSess){
if (DEBUG) _log.debug("Creating association request, type: " + type + "DH session: "+ dhSess);
if (type.isVersion2()) set("openid.ns",OPENID2_NS);
set("openid.mode",MODE_ASSOC);
set("openid.session_type",type.getSessionType());
set("openid.assoc_type",type.getAssociationType());
_dhSess=dhSess;
if (dhSess != null) {
set("openid.dh_consumer_public",_dhSess.getPublicKey());
if (!DiffieHellmanSession.DEFAULT_GENERATOR_BASE64.equals(_dhSess.getGenerator()) || !DiffieHellmanSession.DEFAULT_MODULUS_BASE64.equals(_dhSess.getModulus())) {
set("openid.dh_gen",_dhSess.getGenerator());
set("openid.dh_modulus",_dhSess.getModulus());
}
}
}
| Constructs an AssociationRequest message with the specified association type and Diffie-Hellman session. |
public void testReceive_UnconnectedNull() throws Exception {
assertFalse(this.channel1.isConnected());
try {
this.channel1.receive(null);
fail("Should throw a NPE here.");
}
catch ( NullPointerException e) {
}
}
| Test method for 'DatagramChannelImpl.receive(ByteBuffer)' |
private void buildPieces(){
pieces=new Piece[pathArray.size()];
Paint paint=new Paint();
Matrix matrix=new Matrix();
Canvas canvas=new Canvas();
for (int i=0; i < pieces.length; i++) {
int shadow=Utils.nextInt(Utils.dp2px(2),Utils.dp2px(9));
Path path=pathArray.get(i);
RectF r=new RectF();
path.computeBounds(r,true);
Bitmap pBitmap=Utils.createBitmapSafely((int)r.width() + shadow * 2,(int)r.height() + shadow * 2,Bitmap.Config.ARGB_4444,1);
if (pBitmap == null) {
pieces[i]=new Piece(-1,-1,null,shadow);
continue;
}
pieces[i]=new Piece((int)r.left + mTouchPoint.x - shadow,(int)r.top + mTouchPoint.y - shadow,pBitmap,shadow);
canvas.setBitmap(pieces[i].bitmap);
BitmapShader mBitmapShader=new BitmapShader(mBitmap,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
matrix.reset();
matrix.setTranslate(-r.left - offsetX + shadow,-r.top - offsetY + shadow);
mBitmapShader.setLocalMatrix(matrix);
paint.reset();
Path offsetPath=new Path();
offsetPath.addPath(path,-r.left + shadow,-r.top + shadow);
paint.setStyle(Paint.Style.FILL);
paint.setShadowLayer(shadow,0,0,0xff333333);
canvas.drawPath(offsetPath,paint);
paint.setShadowLayer(0,0,0,0);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.XOR));
canvas.drawPath(offsetPath,paint);
paint.setXfermode(null);
paint.setShader(mBitmapShader);
paint.setAlpha(0xcc);
canvas.drawPath(offsetPath,paint);
}
Arrays.sort(pieces);
}
| Build the final bitmap-pieces to draw in animation |
public synchronized void add(String k,String v){
grow();
keys[nkeys]=k;
values[nkeys]=v;
nkeys++;
}
| Adds a key value pair to the end of the header. Duplicates are allowed |
public ClusterJoinResponseMessage(ClusterJoinResponseMessage other){
__isset_bitfield=other.__isset_bitfield;
if (other.isSetHeader()) {
this.header=new AsyncMessageHeader(other.header);
}
this.newNodeId=other.newNodeId;
if (other.isSetNodeStore()) {
List<KeyedValues> __this__nodeStore=new ArrayList<KeyedValues>();
for ( KeyedValues other_element : other.nodeStore) {
__this__nodeStore.add(new KeyedValues(other_element));
}
this.nodeStore=__this__nodeStore;
}
}
| Performs a deep copy on <i>other</i>. |
public boolean isCanReport(){
Object oo=get_Value(COLUMNNAME_IsCanReport);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Can Report. |
@Override public void updateBinaryStream(int columnIndex,InputStream x,long length) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("updateBinaryStream(" + columnIndex + ", x, "+ length+ "L);");
}
checkClosed();
Value v=conn.createBlob(x,length);
update(columnIndex,v);
}
catch ( Exception e) {
throw logAndConvert(e);
}
}
| Updates a column in the current or insert row. |
public GenLOSDriver(ServerInterpreter server,String spaceName,LargeObjectSpace lospace,int blockSize,int threshold,boolean mainSpace){
super(server,spaceName,lospace,blockSize,threshold,mainSpace);
remsetStream=createRemsetStream();
resetData();
}
| Create a new driver for this collector |
public void populateUnmatchesFromMatches(){
this.unmatch.clear();
int previousMatchFinalIndex=0;
for ( DataSet.Bounds oneMatch : this.match) {
if (oneMatch.start > previousMatchFinalIndex) {
this.addUnmatchBounds(previousMatchFinalIndex,oneMatch.start);
}
previousMatchFinalIndex=oneMatch.end;
}
if (previousMatchFinalIndex < string.length()) {
this.addUnmatchBounds(previousMatchFinalIndex,string.length());
}
}
| Creates fully annotated examples based on the provided matches (bounds) All chars are going to be annotated. |
public void timingEvent(float fraction){
alpha=fraction;
repaint();
}
| TimingTarget implementation: this method sets the alpha of our button to be equal to the current elapsed fraction of the animation |
public void rebind(String name,Object obj) throws NamingException {
rebind(nameParser.parse(name),obj);
}
| Rebinds object obj to String name. If there is existing binding it will be overwritten. |
public String formatCheckShareForExportCmd(String dataMover,List<VNXFileExport> exports,Map<String,String> userInfo,String netBios){
if (exports.isEmpty()) {
_log.debug("There is no entry to export");
return null;
}
String mountPoint=entryPathsDiffer(exports);
if (mountPoint == null) {
_log.debug("Single ssh API command is being applied to multiple paths.");
return null;
}
String exportName=exports.get(0).getExportName();
if (exportName == null) {
return null;
}
StringBuilder cmd=new StringBuilder();
cmd.append(dataMover);
cmd.append(" -list -name ");
cmd.append(exportName);
return cmd.toString();
}
| Format check share for export cmd. |
@Override public void handleEvent(Event evt){
Element e=(Element)evt.getTarget();
if (SVGConstants.SVG_EVENT_MOUSEOVER.equals(evt.getType())) {
if (overclass != null) {
SVGUtil.addCSSClass(e,overclass);
}
if (outclass != null) {
SVGUtil.removeCSSClass(e,outclass);
}
}
if (SVGConstants.SVG_EVENT_MOUSEOUT.equals(evt.getType())) {
if (overclass != null) {
SVGUtil.removeCSSClass(e,overclass);
}
if (outclass != null) {
SVGUtil.addCSSClass(e,outclass);
}
}
if (clickisout && SVGConstants.SVG_EVENT_CLICK.equals(evt.getType())) {
if (overclass != null) {
SVGUtil.removeCSSClass(e,overclass);
}
if (outclass != null) {
SVGUtil.addCSSClass(e,outclass);
}
}
}
| Event handler |
public CameraCoordinateTransformer(boolean mirrorX,int displayOrientation,RectF previewRect){
if (!hasNonZeroArea(previewRect)) {
throw new IllegalArgumentException("previewRect");
}
mCameraToPreviewTransform=cameraToPreviewTransform(mirrorX,displayOrientation,previewRect);
mPreviewToCameraTransform=inverse(mCameraToPreviewTransform);
}
| Convert rectangles to / from camera coordinate and preview coordinate space. |
@SuppressWarnings({"HardCodedStringLiteral"}) public String toString(){
final String absolutePath=(file != null) ? file.getAbsolutePath() : "null";
return "File: " + absolutePath + "\nRepositoryFile: "+ rcsFileName+ "\nHead revision: "+ headRevision;
}
| Return a string representation of this object. Useful for debugging. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.