code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
final public int lastIndexOf(final MutableString pattern){
return lastIndexOf(pattern,length());
}
| Returns the index of the last occurrence of the specified mutable string. |
public void addCreds(Credentials creds) throws IOException, Asn1Exception {
creds.cname.writePrincipal(this);
creds.sname.writePrincipal(this);
creds.key.writeKey(this);
write32((int)(creds.authtime.getTime() / 1000));
if (creds.starttime != null) write32((int)(creds.starttime.getTime() / 1000));
else write32(0);
write32((int)(creds.endtime.getTime() / 1000));
if (creds.renewTill != null) write32((int)(creds.renewTill.getTime() / 1000));
else write32(0);
if (creds.isEncInSKey) {
write8(1);
}
else write8(0);
writeFlags(creds.flags);
if (creds.caddr == null) write32(0);
else creds.caddr.writeAddrs(this);
if (creds.authorizationData == null) {
write32(0);
}
else creds.authorizationData.writeAuth(this);
writeTicket(creds.ticket);
writeTicket(creds.secondTicket);
}
| Writes a credentials in FCC format to this cache output stream. |
public void onBindViewHolder(PreferenceViewHolder holder){
if (!constraintsMet()) {
final TextView summaryView=(TextView)holder.findViewById(android.R.id.summary);
if (summaryView != null) {
summaryView.setText(mConstraintViolationSummary);
summaryView.setVisibility(View.VISIBLE);
}
}
}
| Override the summary with any constraint violation messages. |
public VaultToken initializeVault(){
int createKeys=2;
int requiredKeys=2;
VaultInitializationResponse initialized=vaultOperations.opsForSys().initialize(VaultInitializationRequest.create(createKeys,requiredKeys));
for (int i=0; i < requiredKeys; i++) {
VaultUnsealStatus unsealStatus=vaultOperations.opsForSys().unseal(initialized.getKeys().get(i));
if (!unsealStatus.isSealed()) {
break;
}
}
return initialized.getRootToken();
}
| Initialize Vault and unseal the vault. |
public SoftValueHashMap(int initialCapacity,float loadFactor){
hash=new HashMap(initialCapacity,loadFactor);
}
| Constructs a new, empty <code>WeakHashMap</code> with the given initial capacity and the given load factor. |
private boolean allowNotificationEmission(ObjectName name,TargetedNotification tn){
try {
if (checkNotificationEmission) {
checkMBeanPermission(name,"addNotificationListener");
}
if (notificationAccessController != null) {
notificationAccessController.fetchNotification(connectionId,name,tn.getNotification(),getSubject());
}
return true;
}
catch ( SecurityException e) {
if (logger.debugOn()) {
logger.debug("fetchNotifs","Notification " + tn.getNotification() + " not forwarded: the "+ "caller didn't have the required access rights");
}
return false;
}
catch ( Exception e) {
if (logger.debugOn()) {
logger.debug("fetchNotifs","Notification " + tn.getNotification() + " not forwarded: "+ "got an unexpected exception: "+ e);
}
return false;
}
}
| Check if the caller has the right to get the following notifications. |
public void start(final TraceList trace,final Set<BreakpointAddress> relocatedAddresses,final int maximumHits){
Preconditions.checkNotNull(relocatedAddresses,"IE00762: Address list can not be null");
Preconditions.checkArgument(!relocatedAddresses.isEmpty(),"IE00787: Address list can not be empty");
for ( final BreakpointAddress address : relocatedAddresses) {
Preconditions.checkNotNull(address,"IE00788: Address list contains invalid elements");
}
lock.lock();
eventList=trace;
debugger.addListener(m_debuggerListener);
debugger.getProcessManager().addListener(m_processListener);
breakpointManager.addListener(m_breakpointManagerListener);
NaviLogger.info("Starting new event list with name %s",trace.getName());
final Set<BreakpointAddress> collectedAddresses=new HashSet<BreakpointAddress>();
for ( final BreakpointAddress address : relocatedAddresses) {
if (EchoBreakpointCollector.isBlocked(breakpointManager,address)) {
continue;
}
if (!debugger.isConnected()) {
lock.unlock();
return;
}
collectedAddresses.add(address);
}
breakpointManager.addBreakpoints(BreakpointType.ECHO,collectedAddresses);
for ( final BreakpointAddress address : collectedAddresses) {
try {
activeEchoBreakpoints.put(address,maximumHits);
for ( final ITraceLoggerListener listener : listeners) {
listener.addedBreakpoint();
}
}
catch ( final IllegalArgumentException exception) {
CUtilityFunctions.logException(exception);
}
}
if (activeEchoBreakpoints.isEmpty()) {
removeListeners();
}
lock.unlock();
}
| Starts an event trace. |
protected static Object object(int element){
return new Integer(element);
}
| Transforms an element of a primitive data type to an object. |
@NotNull public PsiQuery siblings(@NotNull final Class<? extends PsiNamedElement> clazz,@NotNull final String name){
final List<PsiElement> result=new ArrayList<PsiElement>();
for ( final PsiElement element : myPsiElements) {
final PsiElement parent=element.getParent();
for ( final PsiNamedElement namedSibling : PsiTreeUtil.findChildrenOfType(parent,clazz)) {
if ((!namedSibling.equals(element)) && (name.equals(namedSibling.getName()))) {
result.add(namedSibling);
}
}
}
return new PsiQuery(result.toArray(new PsiElement[result.size()]));
}
| Filter siblings by name and class |
public String pref(){
if (chars[0] != 0) {
return new String(chars,1,chars[0] - 1);
}
return "";
}
| Creates a prefix string from qualified name. |
public static void playSoundBuffer(byte[] wavData){
float sampleRate=11200.0f;
int sampleSizeInBits=8;
int channels=1;
boolean signed=(sampleSizeInBits > 8);
boolean bigEndian=true;
AudioFormat format=new AudioFormat(sampleRate,sampleSizeInBits,channels,signed,bigEndian);
SourceDataLine line;
DataLine.Info info=new DataLine.Info(SourceDataLine.class,format);
if (!AudioSystem.isLineSupported(info)) {
log.warn("line not supported: " + info);
return;
}
try {
line=(SourceDataLine)AudioSystem.getLine(info);
line.open(format);
}
catch ( LineUnavailableException ex) {
log.error("error opening line: " + ex);
return;
}
line.start();
line.write(wavData,0,wavData.length);
}
| Play a sound from a buffer |
public Array createArray(){
ArrayImpl array=new ArrayImpl();
return array;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public ToStringBuilder append(final String fieldName,final short[] array){
style.append(buffer,fieldName,array,null);
return this;
}
| <p>Append to the <code>toString</code> a <code>short</code> array.</p> |
public static void sendChatPacket(Player player,String json) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, InstantiationException, NoSuchFieldException {
Object craftPlayer=Class.forName(PackageType.CRAFTBUKKIT + ".entity.CraftPlayer").cast(player);
Object craftHandle=Class.forName(PackageType.CRAFTBUKKIT + ".entity.CraftPlayer").getMethod("getHandle").invoke(craftPlayer);
Object playerConnection=Class.forName(PackageType.MINECRAFT_SERVER + ".EntityPlayer").getField("playerConnection").get(craftHandle);
Object parsedMessage;
try {
parsedMessage=Class.forName(PackageType.MINECRAFT_SERVER + ".IChatBaseComponent$ChatSerializer").getMethod("a",String.class).invoke(null,ChatColor.translateAlternateColorCodes("&".charAt(0),json));
}
catch ( ClassNotFoundException e) {
parsedMessage=Class.forName(PackageType.MINECRAFT_SERVER + ".ChatSerializer").getMethod("a",String.class).invoke(null,ChatColor.translateAlternateColorCodes("&".charAt(0),json));
}
Object packetPlayOutChat=Class.forName(PackageType.MINECRAFT_SERVER + ".PacketPlayOutChat").getConstructor(Class.forName(PackageType.MINECRAFT_SERVER + ".IChatBaseComponent")).newInstance(parsedMessage);
Class.forName(PackageType.MINECRAFT_SERVER + ".PlayerConnection").getMethod("sendPacket",Class.forName(PackageType.MINECRAFT_SERVER + ".Packet")).invoke(playerConnection,packetPlayOutChat);
}
| Send the chat packet (hover and clickable messages). |
public void test_ConstructorLjava_io_FileI() throws IOException {
zfile.close();
File file=new File(tempFileName);
ZipFile zip=new ZipFile(file,ZipFile.OPEN_DELETE | ZipFile.OPEN_READ);
zip.close();
assertTrue("Zip should not exist",!file.exists());
file=new File(tempFileName);
file.delete();
try {
zip=new ZipFile(file,ZipFile.OPEN_READ);
fail("IOException expected");
}
catch ( IOException ee) {
}
file=new File(tempFileName);
try {
zip=new ZipFile(file,-1);
fail("IllegalArgumentException expected");
}
catch ( IllegalArgumentException ee) {
}
}
| java.util.zip.ZipFile#ZipFile(java.io.File, int) |
static boolean isFlagSet(short flags,short flag){
return (flags & flag) == flag;
}
| Check whether particular flag is set. |
public void alignItemsVertically(){
alignItemsVertically(kDefaultPadding);
}
| align items vertically |
public void showResultsDialog(final boolean visible){
if (m_dialog != null) {
m_dialog.setVisible(visible);
}
}
| Shows or hides the results dialog. |
public JScrollPane(){
this(null,VERTICAL_SCROLLBAR_AS_NEEDED,HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
| Creates an empty (no viewport view) <code>JScrollPane</code> where both horizontal and vertical scrollbars appear when needed. |
static int difference(StringEncoder encoder,String s1,String s2) throws EncoderException {
return differenceEncoded(encoder.encode(s1),encoder.encode(s2));
}
| Encodes the Strings and returns the number of characters in the two encoded Strings that are the same. <ul> <li>For Soundex, this return value ranges from 0 through 4: 0 indicates little or no similarity, and 4 indicates strong similarity or identical values.</li> <li>For refined Soundex, the return value can be greater than 4.</li> </ul> |
public PTBLexer(Reader r,boolean invertable,boolean tokenizeCRs){
this(r);
tokenFactory=new FeatureLabelTokenFactory();
this.invertable=invertable;
this.tokenizeCRs=tokenizeCRs;
}
| Constructs a new PTBLexer which produces FeatureLabels. |
public boolean addAll(int index,Collection<? extends E> c){
Object[] cs=c.toArray();
final ReentrantLock lock=this.lock;
lock.lock();
try {
Object[] elements=getArray();
int len=elements.length;
if (index > len || index < 0) throw new IndexOutOfBoundsException("Index: " + index + ", Size: "+ len);
if (cs.length == 0) return false;
int numMoved=len - index;
Object[] newElements;
if (numMoved == 0) newElements=Arrays.copyOf(elements,len + cs.length);
else {
newElements=new Object[len + cs.length];
System.arraycopy(elements,0,newElements,0,index);
System.arraycopy(elements,index,newElements,index + cs.length,numMoved);
}
System.arraycopy(cs,0,newElements,index,cs.length);
setArray(newElements);
return true;
}
finally {
lock.unlock();
}
}
| Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. |
public static boolean isEmpty(String s){
return (s == null) || s.length() == 0;
}
| Check whether string s is empty. |
public RequestHandle head(Context context,String url,ResponseHandlerInterface responseHandler){
return head(context,url,null,responseHandler);
}
| Perform a HTTP HEAD request without any parameters and track the Android Context which initiated the request. |
@Override public String toString(){
if (eIsProxy()) return super.toString();
StringBuffer result=new StringBuffer(super.toString());
result.append(" (inlineComment_1: ");
result.append(inlineComment_1);
result.append(')');
return result.toString();
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
@Override public Vertex parseVariable(TextStream stream,Map<String,Map<String,Vertex>> elements,boolean debug,Network network){
stream.nextWord();
Vertex variable=parseElementName(Primitive.VARIABLE,stream,elements,debug,network);
stream.skipWhitespace();
ensureNext('{',stream);
stream.skipWhitespace();
while (stream.peek() != '}') {
if (stream.atEnd()) {
throw new SelfParseException("Unexpected end of variable, missing '}'",stream);
}
if (stream.peek() == ':') {
stream.skip();
boolean more=true;
while (more) {
boolean not=false;
stream.skipWhitespace();
if (stream.peek() == '!') {
not=true;
stream.next();
}
Vertex value=parseElement(stream,elements,debug,network);
if (not) {
variable.removeRelationship(Primitive.EQUALS,value);
}
else {
variable.addRelationship(Primitive.EQUALS,value);
}
stream.skipWhitespace();
more=stream.peek() == ',';
if (more) {
stream.next();
}
}
}
else {
String name=stream.nextWord();
if (name == null || !Character.isAlphabetic(name.charAt(0))) {
throw new SelfParseException("Invalid variable attribute: " + name,stream);
}
Vertex attribute=network.createVertex(new Primitive(name));
stream.skipWhitespace();
ensureNext(':',stream);
boolean more=true;
while (more) {
boolean not=false;
stream.skipWhitespace();
if (stream.peek() == '!') {
not=true;
stream.skip();
}
Vertex value=parseElement(stream,elements,debug,network);
if (not) {
variable.removeRelationship(attribute,value);
}
else {
variable.addRelationship(attribute,value);
}
stream.skipWhitespace();
more=stream.peek() == ',';
if (more) {
stream.skip();
stream.skipWhitespace();
}
}
}
stream.skipWhitespace();
ensureNext(';',stream);
stream.skipWhitespace();
}
ensureNext('}',stream);
return variable;
}
| Parse the variable. |
public RestApiClient(String url,int port,AuthenticationToken authenticationToken){
if (!url.startsWith("http")) {
url="http://" + url;
}
restClient=new RestClientBuilder(url + ":" + port).authenticationToken(authenticationToken).connectionTimeout(5000).build();
}
| Instantiates a new rest api client. |
@Override public int compareTo(Vertex o){
if (this.x > o.x) return 1;
if (this.x < o.x) return -1;
if (this.y > o.y) return 1;
if (this.y < o.y) return -1;
if (this.z > o.z) return 1;
if (this.z < o.z) return -1;
return 0;
}
| Comparator that sorts vertices first along the X, then Y and finally Z axis. |
public ScheduledExecutorService eventLoop(){
return eventLoop;
}
| Returns the (singlethreaded) EventLoop on which this router is running.<br> This is required by other Netty ChannelHandlers that want to forward messages to the router. |
private void checkConfiguration(){
if (configuration == null) {
throw new IllegalStateException(ERROR_NOT_INIT);
}
}
| Checks if ImageLoader's configuration was initialized |
protected void drawCubic(Canvas c,LineDataSet dataSet,List<Entry> entries){
Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
int diff=(entryFrom == entryTo) ? 1 : 0;
int minx=Math.max(dataSet.getEntryPosition(entryFrom) - diff,0);
int maxx=Math.min(Math.max(minx + 2,dataSet.getEntryPosition(entryTo) + 1),entries.size());
float phaseX=mAnimator.getPhaseX();
float phaseY=mAnimator.getPhaseY();
float intensity=dataSet.getCubicIntensity();
cubicPath.reset();
int size=(int)Math.ceil((maxx - minx) * phaseX + minx);
if (size - minx >= 2) {
float prevDx=0f;
float prevDy=0f;
float curDx=0f;
float curDy=0f;
Entry prevPrev=entries.get(minx);
Entry prev=entries.get(minx);
Entry cur=entries.get(minx);
Entry next=entries.get(minx + 1);
cubicPath.moveTo(cur.getXIndex(),cur.getVal() * phaseY);
prevDx=(cur.getXIndex() - prev.getXIndex()) * intensity;
prevDy=(cur.getVal() - prev.getVal()) * intensity;
curDx=(next.getXIndex() - cur.getXIndex()) * intensity;
curDy=(next.getVal() - cur.getVal()) * intensity;
cubicPath.cubicTo(prev.getXIndex() + prevDx,(prev.getVal() + prevDy) * phaseY,cur.getXIndex() - curDx,(cur.getVal() - curDy) * phaseY,cur.getXIndex(),cur.getVal() * phaseY);
for (int j=minx + 1, count=Math.min(size,entries.size() - 1); j < count; j++) {
prevPrev=entries.get(j == 1 ? 0 : j - 2);
prev=entries.get(j - 1);
cur=entries.get(j);
next=entries.get(j + 1);
prevDx=(cur.getXIndex() - prevPrev.getXIndex()) * intensity;
prevDy=(cur.getVal() - prevPrev.getVal()) * intensity;
curDx=(next.getXIndex() - prev.getXIndex()) * intensity;
curDy=(next.getVal() - prev.getVal()) * intensity;
cubicPath.cubicTo(prev.getXIndex() + prevDx,(prev.getVal() + prevDy) * phaseY,cur.getXIndex() - curDx,(cur.getVal() - curDy) * phaseY,cur.getXIndex(),cur.getVal() * phaseY);
}
if (size > entries.size() - 1) {
prevPrev=entries.get((entries.size() >= 3) ? entries.size() - 3 : entries.size() - 2);
prev=entries.get(entries.size() - 2);
cur=entries.get(entries.size() - 1);
next=cur;
prevDx=(cur.getXIndex() - prevPrev.getXIndex()) * intensity;
prevDy=(cur.getVal() - prevPrev.getVal()) * intensity;
curDx=(next.getXIndex() - prev.getXIndex()) * intensity;
curDy=(next.getVal() - prev.getVal()) * intensity;
cubicPath.cubicTo(prev.getXIndex() + prevDx,(prev.getVal() + prevDy) * phaseY,cur.getXIndex() - curDx,(cur.getVal() - curDy) * phaseY,cur.getXIndex(),cur.getVal() * phaseY);
}
}
if (dataSet.isDrawFilledEnabled()) {
cubicFillPath.reset();
cubicFillPath.addPath(cubicPath);
drawCubicFill(mBitmapCanvas,dataSet,cubicFillPath,trans,entryFrom.getXIndex(),entryFrom.getXIndex() + size);
}
mRenderPaint.setColor(dataSet.getColor());
mRenderPaint.setStyle(Paint.Style.STROKE);
trans.pathValueToPixel(cubicPath);
mBitmapCanvas.drawPath(cubicPath,mRenderPaint);
mRenderPaint.setPathEffect(null);
}
| Draws a cubic line. |
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key,sequenceNumber);
}
| Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress. |
public static int hashCode(float[] field){
return field == null || field.length == 0 ? 0 : Arrays.hashCode(field);
}
| Computes the hash code of a repeated float field. Null-value and 0-length fields have the same hash code. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public List fetchRowsByIdRelacion(String idRelacion){
return fetchRowsByIdRelacion(idRelacion,TipoUInstalacion.ALL.getIdentificador());
}
| Obtiene las unidades de instalacion pertenecientes a una relacion de entrega |
@Override public synchronized boolean add(E object){
if (elementCount == elementData.length) {
growByOne();
}
elementData[elementCount++]=object;
modCount++;
return true;
}
| Adds the specified object at the end of this vector. |
public Builder<I,O> asBuilder(){
return new Builder<>(name,typeIn,typeOut,converter);
}
| Returns a builder of this object, which can be used to further restrict validation. |
public GuildDeleteHandler(ImplDiscordAPI api){
super(api,true,"GUILD_DELETE");
}
| Creates a new instance of this class. |
public static <T>T notNull(final T argument,final String name){
if (argument == null) {
throw new IllegalArgumentException(name + " should not be null!");
}
return argument;
}
| Will throw IllegalArgumentException if provided object is null on runtime |
public static double CalorieBurned(double activity,double timeHour){
return CalorieBurned(activity,weightKg,timeHour);
}
| weightKg = 77.0 |
private void updateContentDescription(Time time){
int flags=DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR;
String contentDescription=DateUtils.formatDateTime(this.getContext(),time.toMillis(false),flags);
setContentDescription(contentDescription);
}
| Update content description. |
private int findEndOfLabel(String literal){
return literal.lastIndexOf("\"");
}
| Finds the end of the label in a literal string. |
private void handle302MovedTemporarily(SipTransactionContext ctx) throws PayloadException, NetworkException {
if (sLogger.isActivated()) {
sLogger.info("302 Moved Temporarily response received");
}
SipResponse resp=ctx.getSipResponse();
ContactHeader contactHeader=(ContactHeader)resp.getStackMessage().getHeader(ContactHeader.NAME);
String newUri=contactHeader.getAddress().getURI().toString();
mDialogPath.setTarget(newUri);
mDialogPath.incrementCseq();
if (sLogger.isActivated()) {
sLogger.info("Send REGISTER to new address");
}
SipRequest register=SipMessageFactory.createRegister(mDialogPath,mFeatureTags,ctx.getTransaction().getRequest().getExpires().getExpires() * SECONDS_TO_MILLISECONDS_CONVERSION_RATE,mInstanceId,mRcsSettings.isSipKeepAliveEnabled());
sendRegister(register);
}
| Handle 302 response |
public SQLSyntaxErrorException(String reason,String sqlState){
super(reason,sqlState,0);
}
| Creates an SQLSyntaxErrorException object. The Reason string is set to the given reason string, the SQLState string is set to the given SQLState string and the Error Code is set to 0. |
public final Graph search(){
return search(independenceTest.getVariables());
}
| Runs PC starting with a fully connected graph over all of the variables in the domain of the independence test. See PC for caveats. The number of possible cycles and bidirected edges is far less with CPC than with PC. |
@Override public void testFailure(Failure failure){
LoggingUtils.getEvoLogger().info("* Failure: " + failure.getMessage());
for ( StackTraceElement s : failure.getException().getStackTrace()) {
LoggingUtils.getEvoLogger().info(" " + s.toString());
}
this.testResult.setSuccessful(false);
this.testResult.setTrace(failure.getTrace());
this.testResult.incrementFailureCount();
}
| Called when an atomic test fails |
public void bindEntity(Class<?> cls){
Annotation annotation=getFirstAnnotation(cls,Arrays.asList(Include.class,Exclude.class));
Include include=annotation instanceof Include ? (Include)annotation : null;
Exclude exclude=annotation instanceof Exclude ? (Exclude)annotation : null;
if (exclude != null) {
log.trace("Exclude {}",cls.getName());
return;
}
if (include == null) {
log.trace("Missing include {}",cls.getName());
return;
}
String type;
if ("".equals(include.type())) {
type=WordUtils.uncapitalize(cls.getSimpleName());
}
else {
type=include.type();
}
Class<?> duplicate=bindJsonApiToEntity.put(type,cls);
if (duplicate != null && !duplicate.equals(cls)) {
log.error("Duplicate binding {} for {}, {}",type,cls,duplicate);
throw new DuplicateMappingException(type + " " + cls.getName()+ ":"+ duplicate.getName());
}
entityBindings.putIfAbsent(lookupEntityClass(cls),new EntityBinding(this,cls,type));
if (include.rootLevel()) {
bindEntityRoots.add(cls);
}
}
| Add given Entity bean to dictionary. |
private void checkForModuleOrApplication(StandardDefs standardDefs,TypeAnalyzer typeAnalyzer,ClassInfo info,QName qName,Configuration configuration){
if (info != null) {
if (info.implementsInterface(standardDefs.getModulesPackage(),StandardDefs.INTERFACE_IMODULE_NO_PACKAGE) || info.extendsClass(StandardDefs.CLASS_APPLICATION) || info.extendsClass(StandardDefs.CLASS_SPARK_APPLICATION)) {
ClassInfo rootInfo=typeAnalyzer.getClassInfo(configuration.getMainDefinition());
if (rootInfo != null && !rootInfo.implementsInterface(qName.getNamespace(),qName.getLocalPart()) && !rootInfo.extendsClass(qName.toString())) {
ThreadLocalToolkit.getLogger().log(new CompiledAsAComponent(qName.toString(),configuration.getMainDefinition()));
}
}
}
}
| Determine if the class is a module or an application. |
private void initialize(){
this.setLayout(new BorderLayout());
this.setSize(645,321);
this.add(getJSplitPane(),java.awt.BorderLayout.CENTER);
}
| This method initializes this |
public double eulerMacheroniTerm(int N){
try {
return -MathsUtils.digamma(1) + MathsUtils.digamma(N);
}
catch ( Exception e) {
return 0;
}
}
| Returns the value of the Euler-Mascheroni term. Public for debugging purposes |
public static boolean matchesRange(ByteBuffer buffer,int start,byte[] pattern){
for (int i=0; i < pattern.length; ++i) {
if (pattern[i] != buffer.get(start + i)) {
return false;
}
}
return true;
}
| Matches a pattern of bytes against the given buffer starting at the given offset. |
private int nextChar() throws java.io.IOException {
int zzInput;
int zzAction;
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL=zzEndRead;
char[] zzBufferL=zzBuffer;
char[] zzCMapL=ZZ_CMAP;
int[] zzTransL=ZZ_TRANS;
int[] zzRowMapL=ZZ_ROWMAP;
int[] zzAttrL=ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL=zzMarkedPos;
yychar+=zzMarkedPosL - zzStartRead;
zzAction=-1;
zzCurrentPosL=zzCurrentPos=zzStartRead=zzMarkedPosL;
zzState=ZZ_LEXSTATE[zzLexicalState];
int zzAttributes=zzAttrL[zzState];
if ((zzAttributes & 1) == 1) {
zzAction=zzState;
}
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
zzInput=Character.codePointAt(zzBufferL,zzCurrentPosL,zzEndReadL);
zzCurrentPosL+=Character.charCount(zzInput);
}
else if (zzAtEOF) {
zzInput=YYEOF;
break zzForAction;
}
else {
zzCurrentPos=zzCurrentPosL;
zzMarkedPos=zzMarkedPosL;
boolean eof=zzRefill();
zzCurrentPosL=zzCurrentPos;
zzMarkedPosL=zzMarkedPos;
zzBufferL=zzBuffer;
zzEndReadL=zzEndRead;
if (eof) {
zzInput=YYEOF;
break zzForAction;
}
else {
zzInput=Character.codePointAt(zzBufferL,zzCurrentPosL,zzEndReadL);
zzCurrentPosL+=Character.charCount(zzInput);
}
}
int zzNext=zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
if (zzNext == -1) break zzForAction;
zzState=zzNext;
zzAttributes=zzAttrL[zzState];
if ((zzAttributes & 1) == 1) {
zzAction=zzState;
zzMarkedPosL=zzCurrentPosL;
if ((zzAttributes & 8) == 8) break zzForAction;
}
}
}
zzMarkedPos=zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 1:
{
if (yylength() == 1) {
return zzBuffer[zzStartRead];
}
else {
outputSegment.append(yytext());
return outputSegment.nextChar();
}
}
case 55:
break;
case 2:
{
inputStart=yychar;
inputSegment.clear();
inputSegment.append('<');
yybegin(LEFT_ANGLE_BRACKET);
}
case 56:
break;
case 3:
{
inputStart=yychar;
inputSegment.clear();
inputSegment.append('&');
yybegin(AMPERSAND);
}
case 57:
break;
case 4:
{
yypushback(yylength());
outputSegment=inputSegment;
outputSegment.restart();
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
case 58:
break;
case 5:
{
inputSegment.append('#');
yybegin(NUMERIC_CHARACTER);
}
case 59:
break;
case 6:
{
int matchLength=yylength();
inputSegment.write(zzBuffer,zzStartRead,matchLength);
if (matchLength <= 7) {
String decimalCharRef=yytext();
int codePoint=0;
try {
codePoint=Integer.parseInt(decimalCharRef);
}
catch (Exception e) {
assert false : "Exception parsing code point '" + decimalCharRef + "'";
}
if (codePoint <= 0x10FFFF) {
outputSegment=entitySegment;
outputSegment.clear();
if (codePoint >= Character.MIN_SURROGATE && codePoint <= Character.MAX_SURROGATE) {
outputSegment.unsafeWrite(REPLACEMENT_CHARACTER);
}
else {
outputSegment.setLength(Character.toChars(codePoint,outputSegment.getArray(),0));
}
yybegin(CHARACTER_REFERENCE_TAIL);
}
else {
outputSegment=inputSegment;
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
}
else {
outputSegment=inputSegment;
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
}
case 60:
break;
case 7:
{
cumulativeDiff+=inputSegment.length() + yylength() - outputSegment.length();
addOffCorrectMap(outputCharCount + outputSegment.length(),cumulativeDiff);
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
case 61:
break;
case 8:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
if (null != escapedTags && escapedTags.contains(zzBuffer,zzStartRead,yylength())) {
yybegin(START_TAG_TAIL_INCLUDE);
}
else {
yybegin(START_TAG_TAIL_SUBSTITUTE);
}
}
case 62:
break;
case 9:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
if (null != escapedTags && escapedTags.contains(zzBuffer,zzStartRead,yylength())) {
yybegin(START_TAG_TAIL_INCLUDE);
}
else {
yybegin(START_TAG_TAIL_EXCLUDE);
}
}
case 63:
break;
case 10:
{
inputSegment.append('!');
yybegin(BANG);
}
case 64:
break;
case 11:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
yybegin(LEFT_ANGLE_BRACKET_SPACE);
}
case 65:
break;
case 12:
{
inputSegment.append('/');
yybegin(LEFT_ANGLE_BRACKET_SLASH);
}
case 66:
break;
case 13:
{
inputSegment.append(yytext());
}
case 67:
break;
case 14:
{
cumulativeDiff+=inputSegment.length() + yylength();
addOffCorrectMap(outputCharCount,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
}
case 68:
break;
case 15:
{
}
case 69:
break;
case 16:
{
restoreState=SCRIPT_COMMENT;
yybegin(SINGLE_QUOTED_STRING);
}
case 70:
break;
case 17:
{
restoreState=SCRIPT_COMMENT;
yybegin(DOUBLE_QUOTED_STRING);
}
case 71:
break;
case 18:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
if (null != escapedTags && escapedTags.contains(zzBuffer,zzStartRead,yylength())) {
yybegin(END_TAG_TAIL_INCLUDE);
}
else {
yybegin(END_TAG_TAIL_SUBSTITUTE);
}
}
case 72:
break;
case 19:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
if (null != escapedTags && escapedTags.contains(zzBuffer,zzStartRead,yylength())) {
yybegin(END_TAG_TAIL_INCLUDE);
}
else {
yybegin(END_TAG_TAIL_EXCLUDE);
}
}
case 73:
break;
case 20:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
}
case 74:
break;
case 21:
{
if (yylength() == 1) {
return zzBuffer[zzStartRead];
}
else {
outputSegment.append(yytext());
return outputSegment.nextChar();
}
}
case 75:
break;
case 22:
{
previousRestoreState=restoreState;
restoreState=SERVER_SIDE_INCLUDE;
yybegin(SINGLE_QUOTED_STRING);
}
case 76:
break;
case 23:
{
previousRestoreState=restoreState;
restoreState=SERVER_SIDE_INCLUDE;
yybegin(DOUBLE_QUOTED_STRING);
}
case 77:
break;
case 24:
{
yybegin(restoreState);
restoreState=previousRestoreState;
}
case 78:
break;
case 25:
{
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
case 79:
break;
case 26:
{
cumulativeDiff+=inputSegment.length() + yylength() - 1;
addOffCorrectMap(outputCharCount + 1,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return BLOCK_LEVEL_END_TAG_REPLACEMENT;
}
case 80:
break;
case 27:
{
cumulativeDiff+=inputSegment.length() + yylength();
addOffCorrectMap(outputCharCount,cumulativeDiff);
inputSegment.clear();
outputSegment=inputSegment;
yybegin(YYINITIAL);
}
case 81:
break;
case 28:
{
cumulativeDiff+=inputSegment.length() + yylength() - 1;
addOffCorrectMap(outputCharCount + 1,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return BLOCK_LEVEL_START_TAG_REPLACEMENT;
}
case 82:
break;
case 29:
{
restoreState=STYLE_COMMENT;
yybegin(SINGLE_QUOTED_STRING);
}
case 83:
break;
case 30:
{
restoreState=STYLE_COMMENT;
yybegin(DOUBLE_QUOTED_STRING);
}
case 84:
break;
case 31:
{
int length=yylength();
inputSegment.write(zzBuffer,zzStartRead,length);
entitySegment.clear();
char ch=entityValues.get(zzBuffer,zzStartRead,length).charValue();
entitySegment.append(ch);
outputSegment=entitySegment;
yybegin(CHARACTER_REFERENCE_TAIL);
}
case 85:
break;
case 32:
{
int matchLength=yylength();
inputSegment.write(zzBuffer,zzStartRead,matchLength);
if (matchLength <= 6) {
String hexCharRef=new String(zzBuffer,zzStartRead + 1,matchLength - 1);
int codePoint=0;
try {
codePoint=Integer.parseInt(hexCharRef,16);
}
catch (Exception e) {
assert false : "Exception parsing hex code point '" + hexCharRef + "'";
}
if (codePoint <= 0x10FFFF) {
outputSegment=entitySegment;
outputSegment.clear();
if (codePoint >= Character.MIN_SURROGATE && codePoint <= Character.MAX_SURROGATE) {
outputSegment.unsafeWrite(REPLACEMENT_CHARACTER);
}
else {
outputSegment.setLength(Character.toChars(codePoint,outputSegment.getArray(),0));
}
yybegin(CHARACTER_REFERENCE_TAIL);
}
else {
outputSegment=inputSegment;
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
}
else {
outputSegment=inputSegment;
yybegin(YYINITIAL);
return outputSegment.nextChar();
}
}
case 86:
break;
case 33:
{
if (inputSegment.length() > 2) {
inputSegment.append(yytext());
}
else {
yybegin(COMMENT);
}
}
case 87:
break;
case 34:
{
yybegin(YYINITIAL);
if (escapeBR) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
return outputSegment.nextChar();
}
else {
cumulativeDiff+=inputSegment.length() + yylength() - 1;
addOffCorrectMap(outputCharCount + 1,cumulativeDiff);
inputSegment.reset();
return BR_START_TAG_REPLACEMENT;
}
}
case 88:
break;
case 35:
{
cumulativeDiff+=yychar - inputStart + yylength();
addOffCorrectMap(outputCharCount,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
}
case 89:
break;
case 36:
{
yybegin(SCRIPT);
}
case 90:
break;
case 37:
{
yybegin(YYINITIAL);
if (escapeBR) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
return outputSegment.nextChar();
}
else {
cumulativeDiff+=inputSegment.length() + yylength() - 1;
addOffCorrectMap(outputCharCount + 1,cumulativeDiff);
inputSegment.reset();
return BR_END_TAG_REPLACEMENT;
}
}
case 91:
break;
case 38:
{
cumulativeDiff+=yylength();
addOffCorrectMap(outputCharCount,cumulativeDiff);
yybegin(YYINITIAL);
}
case 92:
break;
case 39:
{
yybegin(restoreState);
}
case 93:
break;
case 40:
{
yybegin(STYLE);
}
case 94:
break;
case 41:
{
yybegin(SCRIPT_COMMENT);
}
case 95:
break;
case 42:
{
yybegin(STYLE_COMMENT);
}
case 96:
break;
case 43:
{
restoreState=COMMENT;
yybegin(SERVER_SIDE_INCLUDE);
}
case 97:
break;
case 44:
{
restoreState=SCRIPT_COMMENT;
yybegin(SERVER_SIDE_INCLUDE);
}
case 98:
break;
case 45:
{
restoreState=STYLE_COMMENT;
yybegin(SERVER_SIDE_INCLUDE);
}
case 99:
break;
case 46:
{
yybegin(STYLE);
if (escapeSTYLE) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
inputStart+=1 + yylength();
return outputSegment.nextChar();
}
}
case 100:
break;
case 47:
{
yybegin(SCRIPT);
if (escapeSCRIPT) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
inputStart+=1 + yylength();
return outputSegment.nextChar();
}
}
case 101:
break;
case 48:
{
if (inputSegment.length() > 2) {
inputSegment.append(yytext());
}
else {
cumulativeDiff+=inputSegment.length() + yylength();
addOffCorrectMap(outputCharCount,cumulativeDiff);
inputSegment.clear();
yybegin(CDATA);
}
}
case 102:
break;
case 49:
{
inputSegment.clear();
yybegin(YYINITIAL);
cumulativeDiff+=yychar - inputStart;
int offsetCorrectionPos=outputCharCount;
int returnValue;
if (escapeSTYLE) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
returnValue=outputSegment.nextChar();
}
else {
cumulativeDiff+=yylength() - 1;
++offsetCorrectionPos;
returnValue=STYLE_REPLACEMENT;
}
addOffCorrectMap(offsetCorrectionPos,cumulativeDiff);
return returnValue;
}
case 103:
break;
case 50:
{
inputSegment.clear();
yybegin(YYINITIAL);
cumulativeDiff+=yychar - inputStart;
int offsetCorrectionPos=outputCharCount;
int returnValue;
if (escapeSCRIPT) {
inputSegment.write(zzBuffer,zzStartRead,yylength());
outputSegment=inputSegment;
returnValue=outputSegment.nextChar();
}
else {
cumulativeDiff+=yylength() - 1;
++offsetCorrectionPos;
returnValue=SCRIPT_REPLACEMENT;
}
addOffCorrectMap(offsetCorrectionPos,cumulativeDiff);
return returnValue;
}
case 104:
break;
case 51:
{
outputSegment=entitySegment;
outputSegment.clear();
String surrogatePair=yytext();
char highSurrogate='\u0000';
try {
highSurrogate=(char)Integer.parseInt(surrogatePair.substring(2,6),16);
}
catch (Exception e) {
assert false : "Exception parsing high surrogate '" + surrogatePair.substring(2,6) + "'";
}
try {
outputSegment.unsafeWrite((char)Integer.parseInt(surrogatePair.substring(10,14),16));
}
catch (Exception e) {
assert false : "Exception parsing low surrogate '" + surrogatePair.substring(10,14) + "'";
}
cumulativeDiff+=inputSegment.length() + yylength() - 2;
addOffCorrectMap(outputCharCount + 2,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return highSurrogate;
}
case 105:
break;
case 52:
{
String surrogatePair=yytext();
char highSurrogate='\u0000';
char lowSurrogate='\u0000';
try {
highSurrogate=(char)Integer.parseInt(surrogatePair.substring(2,6),16);
}
catch (Exception e) {
assert false : "Exception parsing high surrogate '" + surrogatePair.substring(2,6) + "'";
}
try {
lowSurrogate=(char)Integer.parseInt(surrogatePair.substring(9,14));
}
catch (Exception e) {
assert false : "Exception parsing low surrogate '" + surrogatePair.substring(9,14) + "'";
}
if (Character.isLowSurrogate(lowSurrogate)) {
outputSegment=entitySegment;
outputSegment.clear();
outputSegment.unsafeWrite(lowSurrogate);
cumulativeDiff+=inputSegment.length() + yylength() - 2;
addOffCorrectMap(outputCharCount + 2,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return highSurrogate;
}
yypushback(surrogatePair.length() - 1);
inputSegment.append('#');
yybegin(NUMERIC_CHARACTER);
}
case 106:
break;
case 53:
{
String surrogatePair=yytext();
char highSurrogate='\u0000';
try {
highSurrogate=(char)Integer.parseInt(surrogatePair.substring(1,6));
}
catch (Exception e) {
assert false : "Exception parsing high surrogate '" + surrogatePair.substring(1,6) + "'";
}
if (Character.isHighSurrogate(highSurrogate)) {
outputSegment=entitySegment;
outputSegment.clear();
try {
outputSegment.unsafeWrite((char)Integer.parseInt(surrogatePair.substring(10,14),16));
}
catch (Exception e) {
assert false : "Exception parsing low surrogate '" + surrogatePair.substring(10,14) + "'";
}
cumulativeDiff+=inputSegment.length() + yylength() - 2;
addOffCorrectMap(outputCharCount + 2,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return highSurrogate;
}
yypushback(surrogatePair.length() - 1);
inputSegment.append('#');
yybegin(NUMERIC_CHARACTER);
}
case 107:
break;
case 54:
{
String surrogatePair=yytext();
char highSurrogate='\u0000';
try {
highSurrogate=(char)Integer.parseInt(surrogatePair.substring(1,6));
}
catch (Exception e) {
assert false : "Exception parsing high surrogate '" + surrogatePair.substring(1,6) + "'";
}
if (Character.isHighSurrogate(highSurrogate)) {
char lowSurrogate='\u0000';
try {
lowSurrogate=(char)Integer.parseInt(surrogatePair.substring(9,14));
}
catch (Exception e) {
assert false : "Exception parsing low surrogate '" + surrogatePair.substring(9,14) + "'";
}
if (Character.isLowSurrogate(lowSurrogate)) {
outputSegment=entitySegment;
outputSegment.clear();
outputSegment.unsafeWrite(lowSurrogate);
cumulativeDiff+=inputSegment.length() + yylength() - 2;
addOffCorrectMap(outputCharCount + 2,cumulativeDiff);
inputSegment.clear();
yybegin(YYINITIAL);
return highSurrogate;
}
}
yypushback(surrogatePair.length() - 1);
inputSegment.append('#');
yybegin(NUMERIC_CHARACTER);
}
case 108:
break;
default :
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF=true;
zzDoEOF();
{
return eofReturnValue;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
| Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs. |
public void drawBytes(byte data[],int offset,int length,int x,int y){
g.drawBytes(data,offset,length,x,y);
}
| Draws the text given by the specified byte array, using this graphics context's current font and color. The baseline of the first character is at position (<i>x</i>, <i>y</i>) in this graphics context's coordinate system. |
public void append(PathIterator pi,boolean connect){
double[] vals=new double[6];
while (!pi.isDone()) {
Arrays.fill(vals,0);
int type=pi.currentSegment(vals);
pi.next();
if (connect && (numVals != 0)) {
if (type == PathIterator.SEG_MOVETO) {
double x=vals[0];
double y=vals[1];
if ((x != cx) || (y != cy)) {
type=PathIterator.SEG_LINETO;
}
else {
if (pi.isDone()) break;
type=pi.currentSegment(vals);
pi.next();
}
}
connect=false;
}
switch (type) {
case PathIterator.SEG_CLOSE:
closePath();
break;
case PathIterator.SEG_MOVETO:
moveTo((float)vals[0],(float)vals[1]);
break;
case PathIterator.SEG_LINETO:
lineTo((float)vals[0],(float)vals[1]);
break;
case PathIterator.SEG_QUADTO:
quadTo((float)vals[0],(float)vals[1],(float)vals[2],(float)vals[3]);
break;
case PathIterator.SEG_CUBICTO:
curveTo((float)vals[0],(float)vals[1],(float)vals[2],(float)vals[3],(float)vals[4],(float)vals[5]);
break;
}
}
}
| Delegates to the enclosed <code>GeneralPath</code>. |
public StringOwnTokenizer(String text,String nontokenDelims,String tokenDelims){
this(text,nontokenDelims,tokenDelims,false);
}
| Constructs a string tokenizer for the specified string. Both token and nontoken delimiters are specified. <p> The current position is set at the beginning of the string. |
public static Matcher<Method> returns(final Matcher<? super Class<?>> returnType){
return new Returns(returnType);
}
| Returns a matcher which matches methods with matching return types. |
public static void main(final String[] args){
DOMTestCase.doMain(setNamedItemNS02.class,args);
}
| Runs this test from the command line. |
public Relationship mostConsciousRelationship(Primitive type){
return mostConsciousRelationship(this.network.createVertex(type));
}
| Return the relationship related by the type, with the high consciousness level. |
public HaltCommand(final int packetId){
super(DebugCommandType.CMD_HALT,packetId);
}
| Creates a halt command. |
public static RegExpExpression notRegexp(String property,String regExExpression){
return new RegExpExpression(getPropExpr(property),new ConstantExpression(regExExpression),true);
}
| Regular expression negated (not regexp). |
public void actionPerformed(AnActionEvent event){
triggerAction(null,SearchContext.buildFromDataContext(event.getDataContext()));
}
| Handles IDEA action event |
public Switch(Context context,AttributeSet attrs,int defStyle){
super(context,attrs,defStyle);
mTextPaint=new TextPaint(Paint.ANTI_ALIAS_FLAG);
Resources res=getResources();
DisplayMetrics dm=res.getDisplayMetrics();
mTextPaint.density=dm.density;
mThumbDrawable=res.getDrawable(R.drawable.switch_inner_holo_dark);
mTrackDrawable=res.getDrawable(R.drawable.switch_track_holo_dark);
mTextOn=res.getString(R.string.capital_on);
mTextOff=res.getString(R.string.capital_off);
mThumbTextPadding=res.getDimensionPixelSize(R.dimen.thumb_text_padding);
mSwitchMinWidth=res.getDimensionPixelSize(R.dimen.switch_min_width);
mSwitchTextMaxWidth=res.getDimensionPixelSize(R.dimen.switch_text_max_width);
mSwitchPadding=res.getDimensionPixelSize(R.dimen.switch_padding);
setSwitchTextAppearance(context,android.R.style.TextAppearance_Material_Small);
ViewConfiguration config=ViewConfiguration.get(context);
mTouchSlop=config.getScaledTouchSlop();
mMinFlingVelocity=config.getScaledMinimumFlingVelocity();
refreshDrawableState();
setChecked(isChecked());
}
| Construct a new Switch with a default style determined by the given theme attribute, overriding specific style attributes as requested. |
public Set<IonValue> generateValues(){
switch (valueType) {
case DECIMAL:
return generateIonDecimals();
case FLOAT:
return generateIonFloats();
case INT:
return generateIonInts();
case SYMBOL:
return generateIonSymbols();
case TIMESTAMP:
return generateIonTimestamps();
default :
fail("not supported: " + valueType);
return null;
}
}
| Generate a Set of IonValues from the configuration properties that were set. |
public void layoutGraph(ArrayList<Integer> nPosX,ArrayList<Integer> nPosY){
if (m_bNeedsUndoAction) {
addUndoAction(new LayoutGraphAction(nPosX,nPosY));
}
m_nPositionX=nPosX;
m_nPositionY=nPosY;
}
| set positions of all nodes |
public void loadArg(final int arg){
loadInsn(argumentTypes[arg],getArgIndex(arg));
}
| Generates the instruction to load the given method argument on the stack. |
@Override public void repaintUI(){
Frame[] frames=Frame.getFrames();
for ( Frame frame : frames) {
repaintUI(frame);
}
}
| Repaints all displayable window. |
public boolean match(CharacterLiteral node,Object other){
if (!(other instanceof CharacterLiteral)) {
return false;
}
CharacterLiteral o=(CharacterLiteral)other;
return safeEquals(node.getEscapedValue(),o.getEscapedValue());
}
| Returns whether the given node and the other object match. <p> The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed. </p> |
public void removeDocumentFromCache(int n){
if (DTM.NULL == n) return;
for (int i=m_sourceTree.size() - 1; i >= 0; --i) {
SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
if (st != null && st.m_root == n) {
m_sourceTree.removeElementAt(i);
return;
}
}
}
| JJK: Support <?xalan:doc_cache_off?> kluge in ElemForEach. TODO: This function is highly dangerous. Cache management must be improved. |
public void run(){
if (sLogger.isActivated()) {
sLogger.debug("RTP Receiver processing is started");
}
try {
while (mDatagramConnection != null) {
byte[] data=mDatagramConnection.receive();
if (data.length >= 12) {
int payloadType=(byte)((data[1] & 0xff) & 0x7f);
if (payloadType != 20) {
int seqnum=(char)((data[2] << 8) | (data[3] & 0xff));
if (seqnum > mLastSeqnum - 10) {
if (mBuffer.size() >= FIFO_MAX_NUMBER) {
mBuffer.clean(FIFO_CLEAN_NUMBER);
}
mBuffer.addObject(data);
mLastSeqnum=seqnum;
}
else {
mStats.numBadRtpPkts++;
}
}
}
}
}
catch ( NetworkException e) {
if (!mInterrupted) {
if (sLogger.isActivated()) {
sLogger.debug(e.getMessage());
}
}
}
catch ( RuntimeException e) {
sLogger.error("Datagram socket server failed!",e);
}
}
| Background processing |
public static void copy(InputStream in,boolean closeIn,OutputStream out,boolean closeOut) throws IOException {
try {
try {
IOUtils.copy(in,out);
}
finally {
if (closeIn) IOUtils.closeQuietly(in);
}
}
finally {
if (closeOut) IOUtils.closeQuietly(out);
}
}
| Copy an InputStream to an OutputStream, optionally closing either the input or the output. |
public InterruptedIOException(java.lang.String s){
super(s);
}
| Constructs an InterruptedIOException with the specified detail message. The string s can be retrieved later by the method of class java.lang.Throwable. s - the detail message. |
public BinaryProperty(File file) throws IOException {
this.data=new Gobble(file).asByteArray();
}
| Creates a new binary property. |
@Override public void ready(){
rerollInitiativeB.setEnabled(false);
butDone.setEnabled(false);
clientgui.getClient().sendDone(true);
}
| Sets you as ready and disables the ready button. |
protected void onOffline(){
if (offlineMenuItem != null) {
offlineMenuItem.setVisible(true);
}
logger.debug("You are now offline");
}
| Sub-classes may override this method to handle disconnected state. |
@Override public String toString(){
JSONObject jsonResult=new JSONObject();
try {
jsonResult.put(PATH,"__path");
jsonResult.put(METHOD,this.mMethod);
if (!mHeaderParams.isEmpty()) {
JSONObject metaJson=new JSONObject();
for ( String headerKey : mHeaderParams.keySet()) {
metaJson.put(headerKey,mHeaderParams.get(headerKey));
}
jsonResult.put(META,metaJson);
}
if (!mQueryParams.isEmpty()) {
JSONObject queryJson=new JSONObject();
for ( String headerKey : mQueryParams.keySet()) {
queryJson.put(headerKey,mQueryParams.get(headerKey));
}
jsonResult.put(GET,queryJson);
}
if (!TextUtils.isEmpty(mContent)) {
JSONObject postJson=new JSONObject(mContent);
jsonResult.put(POST,postJson);
}
}
catch ( JSONException e) {
e.printStackTrace();
}
return jsonResult.toString().replace("__path",this.mPath) + ESCAPE;
}
| { "nonce": 10086, "path": "/v1/device/", "method": "GET", "meta": { "Authorization": "token 000..." }, "get": {"a"=1,"b"=2}, "post": {"commandKey":"commandValue"}, }\r\n |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public Status acknowledgeMessageArrival(String clientHandle,String id){
if (messageStore.discardArrived(clientHandle,id)) {
return Status.OK;
}
else {
return Status.ERROR;
}
}
| Called by the Activity when a message has been passed back to the application |
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
| Util method to write an attribute without the ns prefix |
private static double calculateFallingDamage(double odds,Entity ent){
double dmg=odds;
dmg*=1.0 - (Compute.oddsAbove(ent.getBasePilotingRoll().getValue(),ent.getCrew().getOptions().booleanOption(OptionsConstants.PILOT_APTITUDE_PILOTING)) / 100.0);
dmg*=ent.getWeight() * 0.1;
return dmg;
}
| Calculates the Falling damage after a successful To-Hit. |
public final RowSet merge(final RowSet c) throws SpaceExceededException {
assert c != null;
return mergeEnum(this,c);
}
| merge this row collection with another row collection. The resulting collection is sorted and does not contain any doubles, which are also removed during the merge. The new collection may be a copy of one of the old one, or can be an alteration of one of the input collections After this merge, none of the input collections should be used, because they can be altered |
public Object clone(){
IVector clone=null;
try {
clone=(IVector)super.clone();
}
catch ( Exception e) {
System.err.println("Error cloning " + getClass().getName() + ":");
e.printStackTrace();
System.exit(1);
}
clone.vector=(int[])vector.clone();
return clone;
}
| Returns a deep clone of this vector. |
public static int dpToPx(float dp,Resources resources){
float px=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,resources.getDisplayMetrics());
return (int)px;
}
| Convert Dp to Pixel |
private boolean isNameValid(ProjectTypeDef type){
boolean valid=true;
if (type.getId() == null || type.getId().isEmpty() || NAME_PATTERN.matcher(type.getId()).find()) {
LOG.error("Could not register Project Type ID is null or invalid (only Alphanumeric, dash, point and underscore allowed): " + type.getClass().getName());
valid=false;
}
if (type.getDisplayName() == null || type.getDisplayName().isEmpty()) {
LOG.error("Could not register Project Type with null or empty display name: " + type.getId());
valid=false;
}
for ( Attribute attr : type.getAttributes()) {
if (NAME_PATTERN.matcher(attr.getName()).find()) {
LOG.error("Could not register Project Type with invalid attribute Name (only Alphanumeric, dash and underscore allowed): " + attr.getClass().getName() + " ID: '"+ attr.getId()+ "'");
valid=false;
}
}
return valid;
}
| Checks if incoming Project Type definition has valid ID (Pattern.compile("[^a-zA-Z0-9-_.]") and display name (should not be null or empty) |
@Override public void run(){
amIActive=true;
boolean image1Bool=false;
boolean image2Bool=false;
double constant1=0;
double constant2=0;
if (args.length < 3) {
showFeedback("Plugin parameters have not been set properly.");
return;
}
String inputHeader1=args[0];
File file=new File(inputHeader1);
image1Bool=file.exists();
if (image1Bool) {
constant1=-1;
}
else {
constant1=Double.parseDouble(file.getName().replace(".dep",""));
}
file=null;
String inputHeader2=args[1];
file=new File(inputHeader2);
image2Bool=file.exists();
if (image2Bool) {
constant2=-1;
}
else {
constant2=Double.parseDouble(file.getName().replace(".dep",""));
}
file=null;
String outputHeader=args[2];
if ((inputHeader1 == null) || (inputHeader2 == null) || (outputHeader == null)) {
showFeedback("One or more of the input parameters have not been set properly.");
return;
}
try {
int row, col;
double z1, z2;
int progress, oldProgress=-1;
double[] data1;
double[] data2;
if (image1Bool && image2Bool) {
WhiteboxRaster inputFile1=new WhiteboxRaster(inputHeader1,"r");
WhiteboxRaster inputFile2=new WhiteboxRaster(inputHeader2,"r");
int rows=inputFile1.getNumberRows();
int cols=inputFile1.getNumberColumns();
double noData1=inputFile1.getNoDataValue();
double noData2=inputFile2.getNoDataValue();
if ((inputFile2.getNumberRows() != rows) || (inputFile2.getNumberColumns() != cols)) {
showFeedback("The input images must have the same dimensions and coordinates. Operation cancelled.");
return;
}
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader1,WhiteboxRaster.DataType.FLOAT,noData1);
outputFile.setPreferredPalette(inputFile1.getPreferredPalette());
for (row=0; row < rows; row++) {
data1=inputFile1.getRowValues(row);
data2=inputFile2.getRowValues(row);
for (col=0; col < cols; col++) {
z1=data1[col];
z2=data2[col];
if ((z1 != noData1) && (z2 != noData2)) {
if (z2 != 0) {
outputFile.setValue(row,col,z1 % z2);
}
else {
outputFile.setValue(row,col,Double.POSITIVE_INFINITY);
}
}
else {
outputFile.setValue(row,col,noData1);
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile1.close();
inputFile2.close();
outputFile.close();
}
else if (image1Bool) {
WhiteboxRaster inputFile1=new WhiteboxRaster(inputHeader1,"r");
int rows=inputFile1.getNumberRows();
int cols=inputFile1.getNumberColumns();
double noData=inputFile1.getNoDataValue();
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader1,WhiteboxRaster.DataType.FLOAT,noData);
outputFile.setPreferredPalette(inputFile1.getPreferredPalette());
for (row=0; row < rows; row++) {
data1=inputFile1.getRowValues(row);
for (col=0; col < cols; col++) {
z1=data1[col];
if (z1 != noData && constant2 != 0) {
outputFile.setValue(row,col,z1 % constant2);
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile1.close();
outputFile.close();
}
else if (image2Bool) {
WhiteboxRaster inputFile2=new WhiteboxRaster(inputHeader2,"r");
int rows=inputFile2.getNumberRows();
int cols=inputFile2.getNumberColumns();
double noData=inputFile2.getNoDataValue();
WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader2,WhiteboxRaster.DataType.FLOAT,noData);
outputFile.setPreferredPalette(inputFile2.getPreferredPalette());
for (row=0; row < rows; row++) {
data2=inputFile2.getRowValues(row);
for (col=0; col < cols; col++) {
z2=data2[col];
if (z2 != noData && z2 != 0) {
outputFile.setValue(row,col,constant1 % z2);
}
}
progress=(int)(100f * row / (rows - 1));
if (progress != oldProgress) {
oldProgress=progress;
updateProgress((int)progress);
if (cancelOp) {
cancelOperation();
return;
}
}
}
outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
outputFile.addMetadataEntry("Created on " + new Date());
inputFile2.close();
outputFile.close();
}
else {
showFeedback("At least one of the inputs must be a raster image.");
}
returnData(outputHeader);
}
catch ( OutOfMemoryError oe) {
myHost.showFeedback("An out-of-memory error has occurred during operation.");
}
catch ( Exception e) {
myHost.showFeedback("An error has occurred during operation. See log file for details.");
myHost.logException("Error in " + getDescriptiveName(),e);
}
finally {
updateProgress("Progress: ",0);
amIActive=false;
myHost.pluginComplete();
}
}
| Used to execute this plugin tool. |
public static double P_PrecisionMicro(int Y[][],int Ypred[][]){
return P_Precision(MatrixUtils.flatten(Y),MatrixUtils.flatten(Ypred));
}
| P_Precision - (retrieved AND relevant) / retrieved |
public static double distance(double x1,double y1,double x2,double y2){
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
| Compute the distance between two points (x1, y1) and (x2, y2) |
public AnnotationVisitor visitTypeAnnotation(int typeRef,TypePath typePath,String desc,boolean visible){
if (api < Opcodes.ASM5) {
throw new RuntimeException();
}
if (mv != null) {
return mv.visitTypeAnnotation(typeRef,typePath,desc,visible);
}
return null;
}
| Visits an annotation on a type in the method signature. |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public Builder config(Bitmap.Config config){
this.config=config;
return this;
}
| Decode the image using the specified config. |
public boolean isFirstNameOnly(){
Object oo=get_Value(COLUMNNAME_IsFirstNameOnly);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get First name only. |
protected GenericPermsImpl(){
_perms=new PermsImpl();
}
| Construye un objeto de la clase. |
public final boolean sendEmptyMessage(int what){
return mExec.sendEmptyMessage(what);
}
| Sends a Message containing only the what value. |
private void loadProperties(Class c,String parsersFile,boolean verbose,boolean parserWarning,boolean canReplace) throws IOException {
if (verbose) {
if (parsersFile.equalsIgnoreCase(RELEASE + PARSER_PROPERTIES_SUFFIX)) {
System.out.println("\nAlways loading " + parsersFile + ":");
}
else {
System.out.println("\n\nLoading additional parsers (" + parsersFile + "):");
}
}
final InputStream stream=c.getResourceAsStream(parsersFile);
if (stream == null) {
throw new RuntimeException("Parsers file not found: " + parsersFile);
}
BufferedReader reader=new BufferedReader(new InputStreamReader(stream));
String line=reader.readLine();
while (line != null) {
if (verbose && line.trim().startsWith("#")) System.out.println(line);
if (line.trim().length() > 0 && !line.trim().startsWith("#")) {
try {
if (line.contains("Vector")) {
System.out.println("");
}
Class parser=Class.forName(line);
if (XMLObjectParser.class.isAssignableFrom(parser)) {
boolean replaced=addXMLObjectParser((XMLObjectParser)parser.newInstance(),canReplace);
if (verbose) {
System.out.println((replaced ? "Replaced" : "Loaded") + " parser: " + parser.getName());
}
else if (parserWarning && replaced) {
System.out.println("WARNING: parser - " + parser.getName() + " in "+ parsersFile+ " is duplicated, "+ "which is REPLACING the same parser loaded previously.\n");
}
}
else {
boolean parserFound=false;
Field[] fields=parser.getDeclaredFields();
for ( Field field : fields) {
if (XMLObjectParser.class.isAssignableFrom(field.getType())) {
try {
boolean replaced=addXMLObjectParser((XMLObjectParser)field.get(null),canReplace);
if (verbose) {
System.out.println((replaced ? "Replaced" : "Loaded") + " parser: " + parser.getName()+ "."+ field.getName());
}
else if (parserWarning && replaced) {
System.out.println("WARNING: parser - " + parser.getName() + " in "+ parsersFile+ " is duplicated, "+ "which is REPLACING the same parser loaded previously.\n");
}
}
catch ( IllegalArgumentException iae) {
System.err.println("Failed to install parser: " + iae.getMessage());
}
parserFound=true;
}
}
if (!parserFound) {
throw new IllegalArgumentException(parser.getName() + " is not of type XMLObjectParser " + "and doesn't contain any static members of this type");
}
}
}
catch ( Exception e) {
System.err.println("\nFailed to load parser: " + e.getMessage());
System.err.println("line = " + line + "\n");
}
}
line=reader.readLine();
}
if (verbose) {
System.out.println("load " + parsersFile + " successfully.\n");
}
}
| Load the parser for *.properties file |
public T peek(int depth){
if (depth >= size) throw new NoSuchElementException();
else {
Node<T> curr=top;
while (depth-- > 0) curr=curr.next;
return curr.data;
}
}
| <p> Take a look at the element <code>depth</code> levels deep beneath the top element (which is at depth 0). This requires O(depth) steps. </p> |
public void destroy(){
super.destroy();
}
| Destruction of the servlet. <br> |
private static void createImage(final Shell shell,final Image image){
final Label labelImage=new Label(shell,SWT.NONE);
final GridData gdImage=new GridData(GridData.CENTER,GridData.BEGINNING,false,true);
gdImage.horizontalIndent=10;
labelImage.setLayoutData(gdImage);
if (image == null) {
final Image temp=SWTGraphicUtil.createImageFromFile("images/information.png");
labelImage.setImage(temp);
SWTGraphicUtil.addDisposer(shell,temp);
}
else {
labelImage.setImage(image);
}
}
| Creates the image part of the window |
public State(PlotRenderingInfo info){
super(info);
}
| Creates a new state instance. |
public static Integer appendGlobalEdgeComment(final AbstractSQLProvider provider,final INaviEdge edge,final String commentText,final Integer userId) throws CouldntSaveDataException {
Preconditions.checkNotNull(provider,"IE00482: provider argument can not be null");
Preconditions.checkNotNull(edge,"IE00483: edge argument can not be null");
Preconditions.checkNotNull(commentText,"IE00484: commentText argument can not be null");
Preconditions.checkNotNull(userId,"IE00485: userId argument can not be null");
final Connection connection=provider.getConnection().getConnection();
final String function="{ ? = call append_global_edge_comment(?, ?, ?, ?, ?, ?) }";
try {
final int sourceModuleId=getModuleId(edge.getSource());
final int destinationModuleId=getModuleId(edge.getTarget());
final IAddress sourceAddress=CViewNodeHelpers.getAddress(edge.getSource());
final IAddress destinationAddress=CViewNodeHelpers.getAddress(edge.getTarget());
try {
final CallableStatement appendCommentFunction=connection.prepareCall(function);
try {
appendCommentFunction.registerOutParameter(1,Types.INTEGER);
appendCommentFunction.setInt(2,sourceModuleId);
appendCommentFunction.setInt(3,destinationModuleId);
appendCommentFunction.setObject(4,sourceAddress.toBigInteger(),Types.BIGINT);
appendCommentFunction.setObject(5,destinationAddress.toBigInteger(),Types.BIGINT);
appendCommentFunction.setInt(6,userId);
appendCommentFunction.setString(7,commentText);
appendCommentFunction.execute();
final int commentId=appendCommentFunction.getInt(1);
if (appendCommentFunction.wasNull()) {
throw new CouldntSaveDataException("Error: Got an comment id of null from the database");
}
return commentId;
}
finally {
appendCommentFunction.close();
}
}
catch ( final SQLException exception) {
throw new CouldntSaveDataException(exception);
}
}
catch ( final MaybeNullException exception) {
throw new CouldntSaveDataException(exception);
}
}
| Appends a global edge comment to the list of global edge comments associated with this edge. |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(string);
}
catch ( IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode='k';
}
this.comma=true;
return this;
}
throw new JSONException("Value out of sequence.");
}
| Append a value. |
public static float[] RGBtoHSL(int r,int g,int b){
return RGBtoHSL(r,g,b,null);
}
| <p>Returns the HSL (Hue/Saturation/Luminance) equivalent of a given RGB color. All three HSL components are between 0.0 and 1.0.</p> |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.