buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
private boolean validatePage(final String document, final String file) throws IOException
{
return DiffUtil.validatePage(document, this.getClass(), file);
}
| private boolean validatePage(final String document, final String file) throws IOException
{
return DiffUtil.validatePage(document, this.getClass(), file,true);
}
|
public void testPage() throws Exception
{
tester = new WicketTester(Page1.class);
tester.getApplication().mount(new IndexedParamUrlCodingStrategy("/page2", Page2.class));
executeTest(Page1.class, "IndexedParamTest_ExpectedResult-1.html");
// Click the autolink
tester.setupRequestAndResponse();
WebReques... | public void testPage() throws Exception
{
tester = new WicketTester(Page1.class);
tester.getApplication().mount(new IndexedParamUrlCodingStrategy("/page2", Page2.class));
executeTest(Page1.class, "IndexedParamTest_ExpectedResult-1.html");
// Click the autolink
tester.setupRequestAndResponse();
WebReques... |
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
Point size;
if (layout != null) {
if ((wHint == SWT.DEFAULT) || (hHint == SWT.DEFAULT)) {
changed |= (state & LAYOUT_CHANGED) != 0;
size = layout.computeSize (this, wHint, hHint, changed);
state &= ~LAYOUT_CHANGED;
} else ... | public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
Point size;
if (layout != null) {
if ((wHint == SWT.DEFAULT) || (hHint == SWT.DEFAULT)) {
changed |= (state & LAYOUT_CHANGED) != 0;
size = layout.computeSize (this, wHint, hHint, changed);
state &= ~LAYOUT_CHANGED;
} else ... |
private final void renderNext(final MarkupStream markupStream)
{
// Get the current markup element
final MarkupElement element = markupStream.get();
// If it a tag like <wicket..> or <span wicket:id="..." >
if ((element instanceof ComponentTag) && !markupStream.atCloseTag())
{
// Get element as tag
f... | private final void renderNext(final MarkupStream markupStream)
{
// Get the current markup element
final MarkupElement element = markupStream.get();
// If it a tag like <wicket..> or <span wicket:id="..." >
if ((element instanceof ComponentTag) && !markupStream.atCloseTag())
{
// Get element as tag
f... |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
if (bshInterpreter == null) // did we find BeanShell?
{
throw new InvalidVariableException("BeanShell not found");
}
JMeterContext jmctx = JMeterContextService.getContext();
JMete... | public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
if (bshInterpreter == null) // did we find BeanShell?
{
throw new InvalidVariableException("BeanShell not found");
}
JMeterContext jmctx = JMeterContextService.getContext();
JMete... |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
JMeterVariables vars = getVariables();
int sum = 0;
String varName = ((CompoundVariable) values[values.length - 1]).execute();
for (int i = 0; i < values.length - 1; i++) {
sum += ... | public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
JMeterVariables vars = getVariables();
int sum = 0;
String varName = ((CompoundVariable) values[values.length - 1]).execute();
for (int i = 0; i < values.length - 1; i++) {
sum += ... |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
new Integer(1);
globalCounter++;
JMeterVariables vars = getVariables();
boolean perThread = Boolean.valueOf(((CompoundVariable) variables[0]).execute()).booleanValue();
... | public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
new Integer(1);
globalCounter++;
JMeterVariables vars = getVariables();
boolean perThread = Boolean.valueOf(((CompoundVariable) variables[0]).execute()).booleanValue();
... |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
/*
* boolean fullHostName = false; if (((CompoundFunction) values[0])
* .execute() .toLowerCase() .equals("true")) { fullHostName = true; }
*/
... | public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
/*
* boolean fullHostName = false; if (((CompoundFunction) values[0])
* .execute() .toLowerCase() .equals("true")) { fullHostName = true; }
*/
... |
public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
if (values.length >= PARAM_NAME) {
myName = ((CompoundVariable) values[PARAM_NAME - 1]).execute();
}
myValue = ERR_IND;
/*
* To avoid re-opening the file repeatedly after an er... | public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
if (values.length >= PARAM_NAME) {
myName = ((CompoundVariable) values[PARAM_NAME - 1]).execute().trim();
}
myValue = ERR_IND;
/*
* To avoid re-opening the file repeatedly afte... |
public synchronized void setParameters(Collection parameters) throws InvalidVariableException {
checkParameterCount(parameters, 0, 2);
Object []values = parameters.toArray();
int count = values.length;
if (count > 0) {
format = ((CompoundVariable) value... | public synchronized void setParameters(Collection parameters) throws InvalidVariableException {
checkParameterCount(parameters, 0, 2);
Object []values = parameters.toArray();
int count = values.length;
if (count > 0) {
format = ((CompoundVariable) value... |
private void scandir(File dir, TokenizedPath path, boolean fast,
String[] newfiles, LinkedList directoryNamesFollowed) {
String vpath = path.toString();
if (vpath.length() > 0 && !vpath.endsWith(File.separator)) {
vpath += File.separator;
}
// av... | private void scandir(File dir, TokenizedPath path, boolean fast,
String[] newfiles, LinkedList directoryNamesFollowed) {
String vpath = path.toString();
if (vpath.length() > 0 && !vpath.endsWith(File.separator)) {
vpath += File.separator;
}
// av... |
public void execute()
throws TaskException
{
if( !destinationDirectory.isDirectory() )
{
throw new TaskException( "destination directory " + destinationDirectory.getPath() +
" is not valid" );
}
if( !sourceDirectory.isDire... | public void execute()
throws TaskException
{
if( !destinationDirectory.isDirectory() )
{
throw new TaskException( "destination directory " + destinationDirectory.getPath() +
" is not valid" );
}
if( !sourceDirectory.isDire... |
public void init(Application application)
{
PackageResource.bind(application, AjaxBehavior.class, "wicket-ajax.js");
}
| public void init(Application application)
{
PackageResource.bind(application, AbstractDefaultAjaxBehavior.class, "wicket-ajax.js");
}
|
public void testNull() throws Exception {
try {
new FileRowColContainer("testfiles/xyzxyz");
fail("Should not find the file");
} catch (FileNotFoundException e) {
}
}
| public void testNull() throws Exception {
try {
new FileRowColContainer(findTestPath("testfiles/xyzxyz"));
fail("Should not find the file");
} catch (FileNotFoundException e) {
}
}
|
public void testFile() throws Exception {
AuthManager am = new AuthManager();
CollectionProperty ao = am.getAuthObjects();
assertEquals(0, ao.size());
am.addFile("testfiles/TestAuth.txt");
assertEquals(9, ao.size());
Authorization at;
... | public void testFile() throws Exception {
AuthManager am = new AuthManager();
CollectionProperty ao = am.getAuthObjects();
assertEquals(0, ao.size());
am.addFile(findTestPath("testfiles/TestAuth.txt"));
assertEquals(9, ao.size());
Authoriza... |
public void testLoad() throws Exception{
assertEquals(0,man.getCookieCount());
man.addFile("testfiles/cookies.txt");
assertEquals(3,man.getCookieCount());
int num = 0;
assertEquals("name",man.get(num).getName());
assertEquals("value",man.g... | public void testLoad() throws Exception{
assertEquals(0,man.getCookieCount());
man.addFile(findTestPath("testfiles/cookies.txt"));
assertEquals(3,man.getCookieCount());
int num = 0;
assertEquals("name",man.get(num).getName());
assertEquals... |
public boolean doGet(final HttpServletRequest servletRequest,
final HttpServletResponse servletResponse) throws ServletException, IOException
{
String relativePath = getRelativePath(servletRequest);
// Special-case for home page - we redirect to add a trailing slash.
if (relativePath.length() == 0 &&
!Str... | public boolean doGet(final HttpServletRequest servletRequest,
final HttpServletResponse servletResponse) throws ServletException, IOException
{
String relativePath = getRelativePath(servletRequest);
// Special-case for home page - we redirect to add a trailing slash.
if (relativePath.length() == 0 &&
!Str... |
protected void onProcessEvents(final RequestCycle requestCycle)
{
getPage().startComponentRender(getTarget());
final Application application = requestCycle.getApplication();
// and see if we have to redirect the render part by default
IRequestCycleSettings.RenderStrategy strategy = application.getRequestCycl... | protected void onProcessEvents(final RequestCycle requestCycle)
{
getPage().startComponentRender(getTarget());
final Application application = requestCycle.getApplication();
// and see if we have to redirect the render part by default
IRequestCycleSettings.RenderStrategy strategy = application.getRequestCycl... |
public String getConfigurationType()
{
return Application.DEPLOYMENT;
}
};
WicketTester tester = new WicketTester(application);
cache = new MarkupCache(application);
component = new MarkupCachingAssumingComponent("panel");
tester.startComponent(component);
}
| public String getConfigurationType()
{
return Application.DEPLOYMENT;
}
};
WicketTester tester = new WicketTester(application);
cache = new MarkupCache();
component = new MarkupCachingAssumingComponent("panel");
tester.startComponent(component);
}
|
public void testBufferedExceptionErrorPage()
{
tester.getApplication().getRequestCycleSettings().setRenderStrategy(
IRequestCycleSettings.REDIRECT_TO_BUFFER);
tester.getApplication().getExceptionSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_EXCEPTION_PAGE);
testInternalErrorPage();
}
| public void testBufferedExceptionErrorPage()
{
tester.getApplication().getRequestCycleSettings().setRenderStrategy(
IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER);
tester.getApplication().getExceptionSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_EXCEPTION_PAGE);
testInternalE... |
public void run() {
if (styledText == null) return;
int i;
long start = System.currentTimeMillis();
for (i = 0; i < lineCount; i++) {
if (lineHeight[i] == -1 || lineWidth[i] == -1) {
calculate(i, 1);
if (System.currentTimeMillis() - start > IDLE_TIME) break;
}
}
if (i < lineCount) ... | public void run() {
if (styledText == null) return;
int i;
long start = System.currentTimeMillis();
for (i = 0; i < lineCount; i++) {
if (lineHeight[i] == -1 || lineWidth[i] == -1) {
calculate(i, 1);
if (System.currentTimeMillis() - start > IDLE_TIME) break;
}
}
if (i < lineCount) ... |
protected String genSourceSignature(FieldDeclaration fieldDeclaration) {
StringBuffer output = new StringBuffer();
if (fieldDeclaration.type == null) { // This is an enum value
output.append(fieldDeclaration.name); // ajh02: the "," or ";" has to be put on by whatever uses the sourceSignature
return output.... | protected String genSourceSignature(FieldDeclaration fieldDeclaration) {
StringBuffer output = new StringBuffer();
if (fieldDeclaration.type == null) { // This is an enum value
output.append(fieldDeclaration.name); // the "," or ";" has to be put on by whatever uses the sourceSignature
return output.toStrin... |
public List /* FileItem */parseRequest(RequestContext ctx) throws FileUploadException
{
if (ctx == null)
{
throw new IllegalArgumentException("ctx parameter cannot be null");
}
ArrayList items = new ArrayList();
String contentType = ctx.getContentType();
if ((null == contentType) || (!contentType.toL... | public List /* FileItem */parseRequest(RequestContext ctx) throws FileUploadException
{
if (ctx == null)
{
throw new IllegalArgumentException("ctx parameter cannot be null");
}
ArrayList items = new ArrayList();
String contentType = ctx.getContentType();
if ((null == contentType) || (!contentType.toL... |
public String getEvictPolicy() {
return super.evictPolicy;
}
} | public EvictPolicy getEvictPolicy() {
return super.evictPolicy;
}
} |
public void init(FilterConfig filterConfig) throws ServletException
{
servletPath = filterConfig.getInitParameter("servletPath");
if (servletPath == null)
{
throw new ServletException(
"you must provide init parameter servlet-path if you want to use "
+ getClass().getName());
}
if (servletP... | public void init(FilterConfig filterConfig) throws ServletException
{
servletPath = filterConfig.getInitParameter("servletPath");
if (servletPath == null)
{
throw new ServletException(
"you must provide init parameter servlet-path if you want to use "
+ getClass().getName());
}
if (servletP... |
public int Point.check(int i, Line l) { return 1 + i; }
}
aspect DeclareCoverage {
pointcut illegalNewFigElt(): call(Point.new(..)) && !withincode(* *.doIt(..));
declare error: illegalNewFigElt(): "Illegal constructor call.";
declare warning: illegalNewFigElt(): "Illegal constructor call.";
| public int Point.check(int i, Line l) { return 1 + i; }
}
aspect DeclareCoverage {
pointcut illegalNewFigElt(): call(Point.new(..)) && !withincode(* *.doIt(..));
declare error: illegalNewFigElt(): "Illegal constructor call.";
declare warning: call(* Point.setX(..)): "Illegal call.";
|
public void testDeclares() {
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "DeclareCoverage");
assertNotNull(aspect);
String label = "declare error: \"Illegal construct..\"";
IProgr... | public void testDeclares() {
IProgramElement node = (IProgramElement)model.getRoot();
assertNotNull(node);
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "DeclareCoverage");
assertNotNull(aspect);
String label = "declare error: \"Illegal construct..\"";
IProgr... |
private void implementMungers() {
World world = getIWorld();
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
ShadowMunger munger = (ShadowMunger) iter.next();
munger.implementOn(this);
if (world.getModel() != null) {
//System.err.println("munger: " + munger + " on " + this);
AsmAdviceR... | private void implementMungers() {
World world = getIWorld();
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
ShadowMunger munger = (ShadowMunger) iter.next();
munger.implementOn(this);
if (world.getModel() != null) {
//System.err.println("munger: " + munger + " on " + this);
AsmRelatio... |
public interface IConvertible
/*
* $Id$
* $Revision$
* $Date$
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
... | public interface IConvertible
/*
* $Id$
* $Revision$
* $Date$
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
... |
protected void setImplicitTypes(Value val1, Value val2, Class expected) {
super.setImplicitTypes(val1, val2, expected);
// as well as setting the types for conversions, we also need to
// ensure that any parameters are declared with the correct type,
// since the JPA spec expects th... | protected void setImplicitTypes(Value val1, Value val2, Class expected) {
super.setImplicitTypes(val1, val2, expected);
// as well as setting the types for conversions, we also need to
// ensure that any parameters are declared with the correct type,
// since the JPA spec expects th... |
public static GC gtk_new(Drawable drawable, GCData data) {
GC gc = new GC();
int /*long*/ gdkGC = drawable.internal_new_GC(data);
gc.device = data.device;
gc.init(drawable, data, gdkGC);
return gc;
}
void checkGC (int mask) {
int state = data.state;
if ((state & mask) == mask) return;
state = (state ^ mask) & ... | public static GC gtk_new(Drawable drawable, GCData data) {
GC gc = new GC();
int /*long*/ gdkGC = drawable.internal_new_GC(data);
gc.device = data.device;
gc.init(drawable, data, gdkGC);
return gc;
}
void checkGC (int mask) {
int state = data.state;
if ((state & mask) == mask) return;
state = (state ^ mask) & ... |
private static final int[][] CODE_PATTERNS = {
{2, 1, 2, 2, 2, 2}, // 0
{2, 2, 2, 1, 2, 2},
{2, 2, 2, 2, 2, 1},
{1, 2, 1, 2, 2, 3},
{1, 2, 1, 3, 2, 2},
{1, 3, 1, 2, 2, 2}, // 5
{1, 2, 2, 2, 1, 3},
{1, 2, 2, 3, 1, 2},
{1, 3, 2, 2, 1, 2},
{2, 2, 1, 2, 1, 3},
... | public Result decodeRow(int rowNumber, BitArray row, Hashtable hints)
throws NotFoundException, FormatException, ChecksumException {
int[] startPatternInfo = findStartPattern(row);
int startCode = startPatternInfo[2];
int codeSet;
switch (startCode) {
case CODE_START_A:
codeSet = ... |
private static final int[][] PATTERNS = {
{N, N, W, W, N}, // 0
{W, N, N, N, W}, // 1
{N, W, N, N, W}, // 2
{W, W, N, N, N}, // 3
{N, N, W, N, W}, // 4
{W, N, W, N, N}, // 5
{N, W, W, N, N}, // 6
{N, N, N, W, W}, // 7
{W, N, N, W, N}, // 8
{N, W, N, W, N} /... | private static final int[] END_PATTERN_REVERSED = {N, N, W};
/**
* Patterns of Wide / Narrow lines to indicate each digit
*/
static final int[][] PATTERNS = {
{N, N, W, W, N}, // 0
{W, N, N, N, W}, // 1
{N, W, N, N, W}, // 2
{W, W, N, N, N}, // 3
{N, N, W, N, W}, // 4
{W... |
protected void setUp() throws Exception {
super.setUp();
assertNotNull(containerUnderTest);
assertTrue(containerUnderTest.startsWith("ecf.discovery."));
container = ContainerFactory.getDefault().createContainer(containerUnderTest);
discoveryContainer = getAdapter(IDiscoveryContainerAdapter.class);
assert... | protected void setUp() throws Exception {
super.setUp();
assertNotNull(containerUnderTest);
assertTrue(containerUnderTest.startsWith("ecf.discovery."));
container = ContainerFactory.getDefault().createContainer(containerUnderTest);
discoveryContainer = getAdapter(IDiscoveryContainerAdapter.class);
assert... |
public static String getAttributeValue(IConfigurationElement configurationElement, String attributeName) {
String attribute = configurationElement.getAttribute(attributeName);
if (attribute != null) {
return attribute;
}
return ""; //$NON-NLS-1$
}
| public static synchronized Map<String, List<IConfigurationElement>> getAnnotationProcessorsCache() {
if (annotationProcessorCache == null) {
annotationProcessorCache = new HashMap<String, List<IConfigurationElement>>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry(... |
public void testLazyTjp() throws IOException {
checkCompile("src1/LazyTjp.aj", new String[] {"-XlazyTjp","-Xlint:error"}, new int[] {96});
// TestUtil.runMain("out", "LazyTjp");
}
| public void testLazyTjp() throws IOException {
checkCompile("src1/LazyTjp.aj", new String[] {"-XlazyTjp","-Xlint:error"}, new int[] {96});
TestUtil.runMain("out", "LazyTjp");
}
|
private void ping() throws IOException, InterruptedException {
Future<?> f = channel.callAsync(new Ping());
long start = System.currentTimeMillis();
long end = start +timeout;
long remaining;
do {
remaining = end-System.currentTimeMillis();
try {
... | private void ping() throws IOException, InterruptedException {
Future<?> f = channel.callAsync(new Ping());
long start = System.currentTimeMillis();
long end = start +timeout;
long remaining;
do {
remaining = end-System.currentTimeMillis();
try {
... |
public synchronized boolean newSol(int val, ResolutionPolicy policy) {
this.policy = policy;
if (nbSol == 0) {
bestVal = val;
}
nbSol++;
boolean isBetter = false;
switch (policy) {
case MINIMIZE:
if (bestVal > val) {
... | public synchronized boolean newSol(int val, ResolutionPolicy policy) {
this.policy = policy;
if (nbSol == 0) {
bestVal = val;
}
nbSol++;
boolean isBetter = false;
switch (policy) {
case MINIMIZE:
if (bestVal > val || nbSol==1) {... |
public State traverse(State s0) {
if (s0.getBackEdge() instanceof SimpleTransfer)
return null;
RoutingRequest rr = s0.getOptions();
double walkspeed = rr.getWalkSpeed();
StateEditor se = s0.edit(this);
int time = (int) (distance / walkspeed);
se.increment... | public State traverse(State s0) {
// use transfer edges only to transfer
// otherwise they are used as shortcuts or break the itinerary generator
if ( ! s0.isEverBoarded())
return null;
if (s0.getBackEdge() instanceof SimpleTransfer)
return null;
Rou... |
public void run() {
try {
int size = 0;
DavGatewayTray.debug(new BundleMessage("LOG_LDAP_REQ_SEARCH", currentMessageId, dn, scope, sizeLimit, timelimit, ldapFilter.toString(), returningAttributes));
if (scope == SCOPE_BASE_OBJECT) {
... | public void run() {
try {
int size = 0;
DavGatewayTray.debug(new BundleMessage("LOG_LDAP_REQ_SEARCH", currentMessageId, dn, scope, sizeLimit, timelimit, ldapFilter.toString(), returningAttributes));
if (scope == SCOPE_BASE_OBJECT) {
... |
public void addListFieldsToMap(HttpServletRequest request, List<SectionField> sectionFields, List entities,
List<Map<String, Object>> paramMapList, boolean useAliasName, boolean useAliasId) {
int sequence = 0;
if (entities != null) {
for (Object thisEnt... | public void addListFieldsToMap(HttpServletRequest request, List<SectionField> sectionFields, List entities,
List<Map<String, Object>> paramMapList, boolean useAliasName, boolean useAliasId) {
int sequence = 0;
if (entities != null) {
for (Object thisEnt... |
private Expr index(final QueryContext ctx, final Data data)
throws QueryException {
// disallow relative paths and numeric predicates
if(root == null || uses(Use.POS)) return this;
// cache index access costs
IndexContext ics = null;
// cheapest predicate and step
int pmin = 0;
int... | private Expr index(final QueryContext ctx, final Data data)
throws QueryException {
// disallow relative paths and numeric predicates
if(root == null || uses(Use.POS)) return this;
// cache index access costs
IndexContext ics = null;
// cheapest predicate and step
int pmin = 0;
int... |
public char la(int k) throws LexerException, ReadException
{
if( !finished && source != null )
{
if( delimited )
{
if( k > characters.length )
{
throw new GroovyBugError( "StringLexer lookahead tolerance exceeded" );
... | public char la(int k) throws LexerException, ReadException
{
if( !finished && source != null )
{
if( delimited )
{
if( k > characters.length )
{
throw new GroovyBugError( "StringLexer lookahead tolerance exceeded" );
... |
public IDL resolve(final Include include, final IDL encapsulatingIDL,
final String encapsulatingName, final Map<Object, Object> context)
throws ADLException {
String path = getIncludedPath(include);
if (getExtension(path).equals(HEADER_EXTENSION)) {
// include node references a header C file... | public IDL resolve(final Include include, final IDL encapsulatingIDL,
final String encapsulatingName, final Map<Object, Object> context)
throws ADLException {
String path = getIncludedPath(include);
if (getExtension(path).equals(HEADER_EXTENSION)) {
// include node references a header C file... |
public static void logOnlyWarnings() {
Log.setMinLogType(Type.Warn);
}
| public static void logOnlyWarnings() {
Log.setMinLogType(Type.Warn);
Log.setGUIStatusKnown();
}
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText(((File)value).getName());
setOpaque(true);
if ((index % 2) == 1) {
setBackground(new Color(0.6f, 1.0f, 0.6f));
} else {
setBackground(Color.white);
}
if (isSelect... | public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value==null)setText("");
else setText(((File)value).getName());
setOpaque(true);
if ((index % 2) == 1) {
setBackground(new Color(0.6f, 1.0f, 0.6f));
} else {
setBackground(... |
public boolean sendLocalChanges(Serializer s) throws IOException {
ContentResolver cr = mService.mContentResolver;
if (getSyncKey().equals("0")) {
return false;
}
try {
// We've got to handle exceptions as part of the parent when changes occur, so we need
... | public boolean sendLocalChanges(Serializer s) throws IOException {
ContentResolver cr = mService.mContentResolver;
if (getSyncKey().equals("0")) {
return false;
}
try {
// We've got to handle exceptions as part of the parent when changes occur, so we need
... |
public boolean invokeTask(String rawMessage) {
String taskName = "";
JSONObject message;
int retryCount = 0;
long retryTimes = 0;
long startedAt = System.nanoTime();
String errorMessage = null;
Throwable lastException = null;
boolean executedSuccessfully = false;
while (retryCount ... | public boolean invokeTask(String rawMessage) {
String taskName = "";
JSONObject message;
int retryCount = 0;
long retryTimes = 0;
long startedAt = System.nanoTime();
String errorMessage = null;
Throwable lastException = null;
boolean executedSuccessfully = false;
while (retryCount ... |
public void generateChunk(World world, int X, int Z, byte[] abyte, Biome[] biomes,
double[] temperature) {
int minHeight = 128;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double heightoffset = (continentNoise.getValue(
(double) (x + (X * 16)) / 10d,
(double) (z + (Z * 16)) ... | public void generateChunk(World world, int X, int Z, byte[] abyte, Biome[] biomes,
double[] temperature) {
int minHeight = 128;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
double heightoffset = (continentNoise.getValue(
(double) (x + (X * 16)) / 10d,
(double) (z + (Z * 16)) ... |
public static String promptOneOf (String prompt, String ... choices)
{
Set<String> choiceSet = new TreeSet<String>(Arrays.asList(choices));
String result;
do
{
result = promptString(prompt + " one of " + choices + "? ");
}
while (!choiceSet.contains(re... | public static String promptOneOf (String prompt, String ... choices)
{
Set<String> choiceSet = new TreeSet<String>(Arrays.asList(choices));
String result;
do
{
StringBuilder buf = new StringBuilder();
for( int i=0; i<choices.length; i++ )
{
... |
public void update(GameContainer gc, int dt)
{
Input input = gc.getInput();
if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON))
{
int x = input.getMouseX();
int y = input.getMouseY();
if(x >= buttonLoc[0] && x <= buttonLoc[0] + menuButton.getWidth() && y >= buttonLoc[1] && y <= buttonLoc[1] + menuButton.... | public void update(GameContainer gc, int dt)
{
Input input = gc.getInput();
if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON))
{
int x = input.getMouseX();
int y = input.getMouseY();
if(x >= buttonLoc[0] && x <= buttonLoc[0] + menuButton.getWidth() && y >= buttonLoc[1] && y <= buttonLoc[1] + menuButton.... |
public void run() {
while (true) {
Socket connection;
synchronized(pool) {
while (pool.isEmpty()) {
try {
pool.wait();
}
catch (InterruptedException e) { ... | public void run() {
while (true) {
Socket connection;
synchronized(pool) {
while (pool.isEmpty()) {
try {
pool.wait();
}
catch (InterruptedException e) { ... |
public final void put(final long id, final Image image, final int level) {
final ListIterator<Entry> li = cache.listIterator(cache.size());
while (li.hasPrevious()) { // images are more likely to be close to the end
final Entry e = li.previous();
if (id == e.id && level == e.level) {
li.remove();
cac... | public final void put(final long id, final Image image, final int level) {
final ListIterator<Entry> li = cache.listIterator(cache.size());
while (li.hasPrevious()) { // images are more likely to be close to the end
final Entry e = li.previous();
if (id == e.id && level == e.level) {
li.remove();
cac... |
public ModelResponse<TransactionReport> invoke(ModelRequest request) {
String domain = request.getDomain();
long date = Long.parseLong(request.getProperty("date"));
String path = m_pathBuilder.getReportPath(new Date(date));
ModelResponse<TransactionReport> response = new ModelResponse<TransactionReport>();
B... | public ModelResponse<TransactionReport> invoke(ModelRequest request) {
String domain = request.getDomain();
long date = Long.parseLong(request.getProperty("date"));
String path = m_pathBuilder.getReportPath(new Date(date));
ModelResponse<TransactionReport> response = new ModelResponse<TransactionReport>();
B... |
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
HttpRequest request = (HttpRequest) e.getMessage();
String userId = getCookie(request, COOKIE_AUTH_NAME);
if (userId == null) {
writeResponse(e, UNAUTHORIZED);
getLogger().info("User not authorized");
} else {
... | public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
HttpRequest request = (HttpRequest) e.getMessage();
String userId = getCookie(request, COOKIE_AUTH_NAME);
if (userId == null) {
writeResponse(e, UNAUTHORIZED);
getLogger().info("User not authorized");
} else {
... |
public static void main(String[] args) throws Exception {
int port = DEFAULT_PORT;
boolean interactive = false;
boolean htmlSuite = false;
boolean multiWindow = false;
String browserString = null;
String startURL = null;
String suiteFilePath = null;
S... | public static void main(String[] args) throws Exception {
int port = DEFAULT_PORT;
boolean interactive = false;
boolean htmlSuite = false;
boolean multiWindow = false;
String browserString = null;
String startURL = null;
String suiteFilePath = null;
S... |
public CoreValue createValue(String value, final int type) {
if (type == PropertyType.BINARY) {
try {
return new BinaryValue(value.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 is not supported", ... | public CoreValue createValue(String value, final int type) {
if (type == PropertyType.BINARY) {
try {
return new BinaryValue(value.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 is not supported", ... |
public void testWaitAndSignal() throws InterruptedException {
WaitingThread thread = new WaitingThread(_semaphore, 0);
thread.start();
Thread.sleep(1);
assertFalse("The thread should be waiting.", thread.hasFinished());
_semaphore.signalEvent();
Thread.sleep(1);
... | public void testWaitAndSignal() throws InterruptedException {
WaitingThread thread = new WaitingThread(_semaphore, 0);
thread.start();
Thread.sleep(2);
assertFalse("The thread should be waiting.", thread.hasFinished());
_semaphore.signalEvent();
Thread.sleep(2);
... |
protected void initializeHomePanel() {
super.initializeHomePanel();
IconImageButton matrixView = new IconImageButton("MatrixIconBtn");
matrixView.setAction(
Application.getInstance().getContext().getActionMap().get("showMatrixView")
);
this.homePanel.add(matrixV... | protected void initializeHomePanel() {
super.initializeHomePanel();
IconImageButton matrixView = new IconImageButton("MatrixIconBtn");
matrixView.setAction(
Application.getInstance().getContext().getActionMap().get("showAndLoadMatrixView")
);
this.homePanel.add(... |
public static void createViewFromCurrentNetwork(CyNetwork cyNetwork) {
System.out.println("Secondary View Threshold: "
+ CytoscapeInit.getSecondaryViewThreshold());
NumberFormat formatter = new DecimalFormat("#,###,###");
if (cyNetwork.getNodeCount()
> CytoscapeI... | public static void createViewFromCurrentNetwork(CyNetwork cyNetwork) {
NumberFormat formatter = new DecimalFormat("#,###,###");
if (cyNetwork.getNodeCount()
> CytoscapeInit.getSecondaryViewThreshold()) {
int n = JOptionPane.showConfirmDialog(Cytoscape.getDesktop(),
... |
RowArea( IRowContent row )
{
super( row );
style.setProperty( IStyle.STYLE_BORDER_TOP_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_LEFT_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_RIGHT_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_BOTTOM_WIDTH, IS... | RowArea( IRowContent row )
{
super( row );
style.setProperty( IStyle.STYLE_BORDER_TOP_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_LEFT_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_RIGHT_WIDTH, IStyle.NUMBER_0 );
style.setProperty( IStyle.STYLE_BORDER_BOTTOM_WIDTH, IS... |
public static Item installItem(Context c, InProgressSubmission is, EPerson e)
throws SQLException, IOException, AuthorizeException
{
Item item = is.getItem();
// create accession date
DCDate now = DCDate.getCurrent();
item.addDC("date", "accessioned", null, now.t... | public static Item installItem(Context c, InProgressSubmission is, EPerson e)
throws SQLException, IOException, AuthorizeException
{
Item item = is.getItem();
// create accession date
DCDate now = DCDate.getCurrent();
item.addDC("date", "accessioned", null, now.t... |
public SWTBotToolbarCheckboxButton toggle() {
log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$
assertEnabled();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
notify(SWT.Activate);
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
notify(SWT.MouseHover);
noti... | public SWTBotToolbarCheckboxButton toggle() {
log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$
assertEnabled();
internalToggle();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
notify(SWT.Activate);
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
notify(SWT... |
private void initViews(){
setContentView(R.layout.dualpane);
if(findViewById(R.id.detail_view) != null){
mMultiPane = true;
} else {
mMultiPane = false;
}
//Force Multipane Layout if User selected the option for it
if(!mMultiPane && DreamDroid.SP.getBoolean("force_multipane", false)){
setConte... | private void initViews(){
setContentView(R.layout.dualpane);
if(findViewById(R.id.detail_view) != null){
mMultiPane = true;
} else {
mMultiPane = false;
}
//Force Multipane Layout if User selected the option for it
if(!mMultiPane && DreamDroid.SP.getBoolean("force_multipane", false)){
setConte... |
public void applyInventory(final BattlePlayer p) {
Inventory i = p.getInventory();
ItemStack BLUE_GLASS = new ItemStack(Material.GLASS, (short) 11);
ItemStack RED_GLASS = new ItemStack(Material.GLASS, (short) 14);
ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_CHESTPL... | public void applyInventory(final BattlePlayer p) {
Inventory i = p.getInventory();
ItemStack BLUE_GLASS = new ItemStack(Material.GLASS, 1, (short) 11);
ItemStack RED_GLASS = new ItemStack(Material.GLASS, 1, (short) 14);
ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_C... |
public Map<String, ILuaEntry> generate(String fileName) {
final Map<String, ILuaEntry> m = new HashMap<String, ILuaEntry>();
try {
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
JLuaFileSystem.register(L);
LuaModuleLoader.register(L);
L.pushJavaFunction(new JavaFunction(L) {
@Ove... | public Map<String, ILuaEntry> generate(String fileName) {
final Map<String, ILuaEntry> m = new HashMap<String, ILuaEntry>();
try {
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
JLuaFileSystem.register(L);
LuaModuleLoader.register(L);
L.pushJavaFunction(new JavaFunction(L) {
@Ove... |
public boolean importFile(InputStream is) {
try {
Workbook wb = WorkbookFactory.create(is);
Sheet sheet = wb.getSheetAt(0);
int i = 0;
for (Row row : sheet) {
i++;
if (i > 1) {
int j = 0;
... | public boolean importFile(InputStream is) {
try {
Workbook wb = WorkbookFactory.create(is);
Sheet sheet = wb.getSheetAt(0);
int i = 0;
for (Row row : sheet) {
i++;
if (i > 1) {
Equipment equipment = new Equip... |
public static EditingDomain getResourceSetFromEditor(IWorkbenchPart part) {
EditingDomain editingDomain = null;
if (part instanceof IEditingDomainProvider)
editingDomain = ((IEditingDomainProvider)part).getEditingDomain();
if (part instanceof IEditorPart) {
if ((((IEditorPart)part).getAdapter(IEditingDomai... | public static EditingDomain getResourceSetFromEditor(IWorkbenchPart part) {
EditingDomain editingDomain = null;
if (part instanceof IEditingDomainProvider) {
editingDomain = ((IEditingDomainProvider)part).getEditingDomain();
} else {
if (part.getAdapter(IEditingDomainProvider.class) != null)
editingDom... |
public void run() {
try {
final URLConnection connection = new URL("http://bukget.org/api/plugins").openConnection();
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final StringBuffer stringBuffer = new String... | public void run() {
try {
final URLConnection connection = new URL("http://bukget.org/api/plugins").openConnection();
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final StringBuffer stringBuffer = new String... |
public boolean validateRequest(String expectedSignature, String url, Map<String,String> params){
SecretKeySpec signingKey = new SecretKeySpec(this.authToken.getBytes(), "HmacSHA1");
try {
//initialize the hash algortihm
Mac mac = Mac.getInstance("HmacSHA1");... | public boolean validateRequest(String expectedSignature, String url, Map<String,String> params){
SecretKeySpec signingKey = new SecretKeySpec(this.authToken.getBytes(), "HmacSHA1");
try {
//initialize the hash algorithm
Mac mac = Mac.getInstance("HmacSHA1");... |
public static Personal[] getPersonal() {
// Create static entries for every person.
Personal[] personal = new Personal[4];
personal[0] = new Personal(
"Jezper Söderlund",
R.drawable.jezper,
"kontakt@jezper.se",
"jezperse",
"http://www.jezper.se",
"En glad och bekväm herre, årsmodell 198... | public static Personal[] getPersonal() {
// Create static entries for every person.
Personal[] personal = new Personal[4];
personal[0] = new Personal(
"Jezper S�derlund",
R.drawable.jezper,
"kontakt@jezper.se",
"jezperse",
"http://www.jezper.se",
"En glad och bekv�m herre, �rsmodell 198... |
private static String addImplicitMultiplicationSigns(String expression,
Context context) {
StringBuilder retVal = new StringBuilder();
for (int i = 0; i < expression.length(); i++) {
Character testChar = expression.charAt(i);
if (testChar.equals('x') || testChar.equals('/')
|| testChar.equals('+')... | private static String addImplicitMultiplicationSigns(String expression,
Context context) {
StringBuilder retVal = new StringBuilder();
for (int i = 0; i < expression.length(); i++) {
Character testChar = expression.charAt(i);
if (testChar.equals('x') || testChar.equals('/')
|| testChar.equals('+')... |
protected String getFirstLine(EObject o) {
EModelElement element = null;
if (o instanceof Import) {
Import self = (Import) o;
element = units.getPackage(self);
} else if (o instanceof Instance) {
Instance self = (Instance) o;
element = units.getClassifier(self);
} else if (element instanceof Slot) ... | protected String getFirstLine(EObject o) {
EModelElement element = null;
if (o instanceof Import) {
Import self = (Import) o;
element = units.getPackage(self);
} else if (o instanceof Instance) {
Instance self = (Instance) o;
element = units.getClassifier(self);
} else if (o instanceof Slot) {
S... |
public void doStart() throws ExporterException {
PrintWriter pw = null;
File file = null;
try {
if(output==null) {
file = new File(getOutputDirectory(), "hibernate.cfg.xml");
getTemplateHelper().ensureExistence(file);
pw = new PrintWriter(new FileWriter(file) );
getArtifact... | public void doStart() throws ExporterException {
PrintWriter pw = null;
File file = null;
try {
if(output==null) {
file = new File(getOutputDirectory(), "hibernate.cfg.xml");
getTemplateHelper().ensureExistence(file);
pw = new PrintWriter(new FileWriter(file) );
getArtifact... |
public void testRead() throws Exception {
// our grib reader
doOne("grib1/data/","cfs.wmo", 51, 4, 6, 3);
doOne("grib1/data/","eta218.grb", 14, 5, 7, 4);
doOne("grib1/data/","extended.wmo", 8, 6, 10, 4);
doOne("grib1/data/","ensemble.wmo", 24, 16, 18, 10);
// doOne("grib1/data/","ecmf.wmo", 5... | public void testRead() throws Exception {
// our grib reader
doOne("grib1/data/","cfs.wmo", 51, 4, 6, 3);
doOne("grib1/data/","eta218.grb", 14, 5, 7, 4);
doOne("grib1/data/","extended.wmo", 8, 6, 10, 4);
doOne("grib1/data/","ensemble.wmo", 24, 16, 18, 10);
// doOne("grib1/data/","ecmf.wmo", 5... |
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
// Show the Up button in the action bar.
if(getActionBar() != null) {
// TODO: workaround for now, figure out what is really going on here.
getActionBar().setDisplayHomeAsUpEna... | protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
// Show the Up button in the action bar.
if(getActionBar() != null) {
// TODO: workaround for now, figure out what is really going on here.
getActionBar().setDisplayHomeAs... |
public static void handleJoin(Arena arena, CommandSender sender, String[] args) {
int priority = 0;
PACheck res = new PACheck();
ArenaModule commModule = null;
for (ArenaModule mod : PVPArena.instance.getAmm().getModules()) {
if (mod.isActive(arena)) {
res = mod.checkJoin(arena, sender, res... | public static void handleJoin(Arena arena, CommandSender sender, String[] args) {
int priority = 0;
PACheck res = new PACheck();
ArenaModule commModule = null;
for (ArenaModule mod : PVPArena.instance.getAmm().getModules()) {
if (mod.isActive(arena)) {
res = mod.checkJoin(arena, sender, res... |
private StringBuffer getXHTML() throws Exception {
//java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy hh:mm:ss z");
//String todaysDate = sdf.format(new java.util.Date());
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy");
Stri... | private StringBuffer getXHTML() throws Exception {
//java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy hh:mm:ss z");
//String todaysDate = sdf.format(new java.util.Date());
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMM dd yyyy");
Stri... |
public void execute() throws JobExecutionException {
OwnerClient client = mock(OwnerClient.class);
when(conn.connect(any(Credentials.class),
any(String.class))).thenReturn(client);
ClientResponse<Owner> resp = mock(ClientResponse.class);
when(client.exportOwner(eq("admin"... | public void execute() throws JobExecutionException {
OwnerClient client = mock(OwnerClient.class);
when(conn.connect(any(Credentials.class),
any(String.class))).thenReturn(client);
ClientResponse<Owner> resp = mock(ClientResponse.class);
when(client.exportOwner(eq("admin"... |
public void changeUI(int a) {
switch (a) {
case 1:
for (int i = 0; i < 64; i++) {
if (table[i] instanceof PieceLabel) {
if (table[i].getPiece() instanceof PawnW) {
table[i].setIcon(new ImageIcon(getClass().ge... | public void changeUI(int a) {
switch (a) {
case 1:
for (int i = 0; i < 64; i++) {
if (table[i] instanceof PieceLabel) {
if (table[i].getPiece() instanceof PawnW) {
table[i].setIcon(new ImageIcon(getClass().ge... |
public void onCreate(Bundle data, Bundle restoreState) {
super.onCreate(data, restoreState);
mActionBar = mActivity.getGalleryActionBar();
mSelectionManager = new SelectionManager(mActivity, false);
mMenuExecutor = new MenuExecutor(mActivity, mSelectionManager);
mPhotoView =... | public void onCreate(Bundle data, Bundle restoreState) {
super.onCreate(data, restoreState);
mActionBar = mActivity.getGalleryActionBar();
mSelectionManager = new SelectionManager(mActivity, false);
mMenuExecutor = new MenuExecutor(mActivity, mSelectionManager);
mPhotoView =... |
private void renderEntities(StateBasedGame game, Graphics g,
LuminousEntity... entities) {
Arrays.sort(entities);
int i = 0;
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
GL11.glBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ZE... | private void renderEntities(StateBasedGame game, Graphics g,
LuminousEntity... entities) {
Arrays.sort(entities);
int i = 0;
// GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_STENCIL_TEST);
GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 1);
... |
private void updateWithLocked(Collection<DownloadInfo> downloads) {
final Resources res = mContext.getResources();
// Cluster downloads together
final Multimap<String, DownloadInfo> clustered = ArrayListMultimap.create();
for (DownloadInfo info : downloads) {
final Strin... | private void updateWithLocked(Collection<DownloadInfo> downloads) {
final Resources res = mContext.getResources();
// Cluster downloads together
final Multimap<String, DownloadInfo> clustered = ArrayListMultimap.create();
for (DownloadInfo info : downloads) {
final Strin... |
public static void ExecuteSwarm(LivingEntity l, String skill, Player player)
{
String[] base = skill.split(" ");
String[] data = base[1].split(":");
float chance = Float.parseFloat(base[base.length-1]);
if(EpicBoss.r.nextFloat() < chance)
{
if(SkillHandler.CheckHealth(base[base.length-2], l, skill))
{... | public static void ExecuteSwarm(LivingEntity l, String skill, Player player)
{
String[] base = skill.split(" ");
String[] data = base[1].split(":");
float chance = Float.parseFloat(base[base.length-1]);
if(EpicBoss.r.nextFloat() < chance)
{
if(SkillHandler.CheckHealth(base[base.length-2], l, skill))
{... |
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
PrintWriter out = response.getWriter();
response.setContentType("text/xml");
String cat = null, tab = null, radString = null;
List<FileItem> fileItemList = null;
FileItemFac... | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
PrintWriter out = response.getWriter();
response.setContentType("text/xml");
String cat = null, tab = null, radString = null;
List<FileItem> fileItemList = null;
FileItemFac... |
public XWalkContent(Context context, AttributeSet attrs, XWalkView xwView) {
super(context, attrs);
// Initialize the WebContensDelegate.
mXWalkView = xwView;
mContentsClientBridge = new XWalkContentsClientBridge(mXWalkView);
mXWalkContentsDelegateAdapter = new XWalkWebConte... | public XWalkContent(Context context, AttributeSet attrs, XWalkView xwView) {
super(context, attrs);
// Initialize the WebContensDelegate.
mXWalkView = xwView;
mContentsClientBridge = new XWalkContentsClientBridge(mXWalkView);
mXWalkContentsDelegateAdapter = new XWalkWebConte... |
public void addNetwork(
@CliOption(key = { "name" }, mandatory = true, help = "Customize the network's name") final String name,
@CliOption(key = { "portGroup" }, mandatory = true, help = "The port group name") final String portGroup,
@CliOption(key = { "dhcp" }, mandatory = false, unspeci... | public void addNetwork(
@CliOption(key = { "name" }, mandatory = true, help = "Customize the network's name") final String name,
@CliOption(key = { "portGroup" }, mandatory = true, help = "The port group name") final String portGroup,
@CliOption(key = { "dhcp" }, mandatory = false, unspeci... |
public static String encode(byte[] buff) {
int next;
int current;
int iBase = 0;
int digit = 0;
int i = 0;
int outputLength = quintetCount(buff) * 8;
StringBuilder builder = new StringBuilder(outputLength);
while(i < buff.length) {
current = get... | public static String encode(byte[] buff) {
int next;
int current;
int iBase = 0;
int digit = 0;
int i = 0;
int outputLength = quintetCount(buff) * 8;
StringBuilder builder = new StringBuilder(outputLength);
while(i < buff.length) {
current = get... |
public Trigger initializeTrigger() {
SimpleTrigger simpleTrigger = new SimpleTrigger();
Date startTime = new Date();
simpleTrigger.setStartTime(startTime);
simpleTrigger.setRepeatInterval(expiration.getTime() - startTime.getTime());
simpleTrigger.setRepeatCount(1);
re... | public Trigger initializeTrigger() {
final SimpleTrigger simpleTrigger = new SimpleTrigger();
simpleTrigger.setStartTime(expiration);
return simpleTrigger;
}
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Get src and dest types from request code
int srcType = (requestCode/16) - 1;
int destType = (requestCode % 16) - 1;
// If CAMERA
if (srcType == CAMERA) {
// If imag... | public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Get src and dest types from request code
int srcType = (requestCode/16) - 1;
int destType = (requestCode % 16) - 1;
// If CAMERA
if (srcType == CAMERA) {
// If imag... |
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
if (pointer == pressedPointer) {
if (!cancelled) {
over = isOver(event.getListenerActor(), x, y);
if (over && pointer == 0 && this.button != -1 && button != this.button) over = false;
if (over) {
long time = TimeU... | public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
if (pointer == pressedPointer) {
if (!cancelled) {
boolean touchUpOver = isOver(event.getListenerActor(), x, y);
// Ignore touch up if the wrong mouse button.
if (touchUpOver && pointer == 0 && this.button != -1 && but... |
public boolean equalsContent(PersonAddress otherAddress) {
boolean returnValue = true;
// these are the methods to compare. All are expected to be Strings
String[] methods = { "getAddress1", "getAddress2", "getAddress3", "getAddress4", "getAddress5", "getCityVillage",
"getNeighborhoodCell", "getCoun... | public boolean equalsContent(PersonAddress otherAddress) {
boolean returnValue = true;
// these are the methods to compare. All are expected to be Strings
String[] methods = { "getAddress1", "getAddress2", "getAddress3", "getAddress4", "getAddress5", "getAddress6",
"getCityVillage", "getCountyDistri... |
static public <T> T typecast(Object o, Class<T> expected) {
if (o == null) {
return null;
}
if (!expected.isAssignableFrom(o.getClass())) {
throw new ClassCastException(String.format(
"Incompatible types: Expected %s, found: %s",
expected.getName(), o.getClass().getName()));
}
return (T) o;
... | static public <T> T typecast(Object o, Class<T> expected) {
if (o == null) {
return null;
}
if (!expected.isAssignableFrom(o.getClass())) {
throw new ClassCastException(String.format(
"Incompatible types. Expected: %s, found: %s",
expected.getName(), o.getClass().getName()));
}
return (T) o;... |
public void doMain(String[] args) {
try {
CmdLineParser parser = new CmdLineParser(this);
parser.setUsageWidth(80);
try {
parser.parseArgument(args);
if (this.version) {
System.out.println("InDelFixer version: " + Start... | public void doMain(String[] args) {
try {
CmdLineParser parser = new CmdLineParser(this);
parser.setUsageWidth(80);
try {
parser.parseArgument(args);
if (this.version) {
System.out.println("InDelFixer version: " + Start... |
public String execute() throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
String domainName = request.getServerName();
if (isEmpty(domainName)) {
domainName = "";
}
// Get the re... | public String execute() throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
String domainName = request.getServerName();
if (isEmpty(domainName)) {
domainName = "";
}
// Get the re... |
public static void main(String[] args)
{
ServerSocket ssocket = null;
Socket connection = null;
OutputStream client = null;
int ch = 0;
if (args.length != 1)
{
System.out.println("Wrong number of args (takes 1).");
return;
}
try
{
ssocket = new ServerSocket(Integer.parseInt(args[0]));
}
... | public static void main(String[] args)
{
ServerSocket ssocket = null;
Socket connection = null;
OutputStream client = null;
int ch = 0;
if (args.length != 1)
{
System.out.println("Wrong number of args (takes 1).");
return;
}
try
{
ssocket = new ServerSocket(Integer.parseInt(args[0]));
}
... |
public void setup(){
//Create the temp dir
final File sysTempDir = new File(System.getProperty("java.io.tmpdir"));
String dirName = UUID.randomUUID().toString();
tempDir = new File(sysTempDir, dirName);
productDir = new File(tempDir,PROJECT_ID);
tempResourcesDir = new... | public void setup(){
//Create the temp dir
final File sysTempDir = new File("target");
String dirName = UUID.randomUUID().toString();
tempDir = new File(sysTempDir, dirName);
productDir = new File(tempDir,PROJECT_ID);
tempResourcesDir = new File(productDir,TMP_RESOURC... |
public void shouldHandleRepeatedFields() throws IOException {
String inputFile = "./tmp/test/data/small.seq";
String outputDir = "./tmp/test/output/names-out";
Messages.Person strongbad = personBuilder().setId(456).setName("strongbad").build();
Messages.Person homestar = personBuild... | public void shouldHandleRepeatedFields() throws IOException {
String inputFile = "./tmp/test/data/small.seq";
String outputDir = "./tmp/test/output/names-out";
Messages.Person strongbad = personBuilder().setId(456).setName("strongbad").build();
Messages.Person homestar = personBuild... |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String data_value_str = request.getParameter("data_value");
// data_value_str = data_value_str.toLowerCase();
// Convert string to corresponding int 0-off 1-on
int ... | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String data_value_str = request.getParameter("data_value");
// data_value_str = data_value_str.toLowerCase();
// Convert string to corresponding int 0-off 1-on
int ... |
public JobTrackerInfoServer(JobTracker jobTracker, int port) throws IOException {
this.jobTracker = jobTracker;
this.server = new org.mortbay.jetty.Server();
URL url = JobTrackerInfoServer.class.getClassLoader().getResource("webapps");
String path = url.getPath();
if (WINDOWS && path.startsWith("... | public JobTrackerInfoServer(JobTracker jobTracker, int port) throws IOException {
this.jobTracker = jobTracker;
this.server = new org.mortbay.jetty.Server();
URL url = JobTrackerInfoServer.class.getClassLoader().getResource("webapps");
String path = url.getPath();
if (WINDOWS && path.startsWith("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.