method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d46fc597-1257-43b2-bf0a-deddb266f0c3 | 8 | public Frame8() {
try{
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER, PASS);
statement = conn.createStatement();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
setTitle("Blok D, 34 - 67");
setDefaultCloseOperation(JF... |
4878c36b-b9ce-4646-b655-30bf00a680b4 | 1 | @Override
public Insets getAutoscrollInsets() {
JScrollPane scrollPane = UIUtilities.getAncestorOfType(this, JScrollPane.class);
if (scrollPane != null) {
Rectangle bounds = scrollPane.getViewport().getViewRect();
return new Insets(bounds.y + AUTO_SCROLL_MARGIN, bounds.x + AUTO_SCROLL_MARGIN, getHeight() - (... |
0665a614-9b2b-4be4-93bc-1ef08ab59cb3 | 6 | @Override
public void handle(HttpRequest request, HttpResponse response, HttpContext context)
throws HttpException, IOException {
String method = request.getRequestLine().getMethod()
.toUpperCase(Locale.ENGLISH);
if (!method.equals("GET") && !method.equals("HEAD")
&& !method.equals("POST")) {
throw n... |
f1157ad7-e84a-46a8-a969-457e6170106f | 7 | public Raster getRaster(int x, int y, int w, int h) {
ColorSpace cs = getColorModel().getColorSpace();
int numComponents = cs.getNumComponents();
// all the data, plus alpha channel
int[] imgData = new int[w * h * (numComponents + 1)];
// the x and y st... |
92c1eaa1-7c4d-4a59-b62d-cdc3445c5e3f | 6 | @SuppressWarnings("rawtypes")
private void reflectInvokeMethod(Object invokeVictim, Method method,
String[] args) throws Exception
{
Class[] parameterTypes = method.getParameterTypes();
Object[] conformingArguments = new Object[parameterTypes.length];
if (args.length < paramete... |
c30343bb-3928-48bb-b41b-8546151824d0 | 2 | private Connection getConnection()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://" + hostname + "/" + databaseName + "?user=" + username + "&password=" + password);
}
catch (ClassNotFoundException e)
{... |
29e1970e-ae85-44a1-bd71-5a852468aa00 | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if (xa < 0) xa... |
c59a02e4-2363-44ba-88b8-88a380426976 | 0 | protected void updateTables() throws SQLException {
updateTable("users", SQLPermissionUser.getColumns());
updateTable("entities", SQLPermissionEntity.getColumns());
updateTable("groups", SQLPermissionGroup.getColumns());
updateTable("worlds", SQLPermissionWorld.getColumns());
upd... |
a7214ad6-858a-4ef6-91f6-64bc91983cb3 | 4 | private void animateUV(int gridX, int gridY, int frames) {
int frame = 0 ;
float U, V ;
final float oldUV[] = framesUV[0] ;
final float newUV[][] = new float[frames][oldUV.length] ;
loop: for (int y = 0 ; y < gridY ; y++) for (int x = 0 ; x < gridX ; x++) {
for (int t = 0 ; t < oldUV.length ;)... |
ec5bdf2d-fc1f-4d06-9e61-e6ac7bae9626 | 2 | public static synchronized NetworkSharedUser getUserByName(String name) {
for(NetworkSharedUser u : usersOnline) {
if(u.getName().equalsIgnoreCase(name)) {
return u;
}
}
return null;
} |
e8c4c2aa-bdd1-4956-955a-37ef3eb6df35 | 2 | private boolean processComplexSymbolValue(String symbol, String symbolRef) throws Exception {
List<String> values = SymbolComplexValueHelper.processComplexValue(symbolRef);
for(String item : values ){
if(item.equals(symbol))
return true;
}
return fals... |
2064d510-d283-4d98-8774-ba98914cb6bf | 3 | public void updatePrice() {
if (gp == null) {
return;
}
BlockVector max = region.getMaximumPoint();
BlockVector min = region.getMinimumPoint();
max.setY(min.getY());
int x = 0;
int z = 0;
if (max.getX() > min.getX()) {
x = (int) (max.getX() - min.getX()) + 1;
} else {
x = (int) (min.getX() - ... |
8319815a-5344-4d38-9920-a729452590e1 | 8 | @Override
public void copySources( HashMap<String, Source> srcMap )
{
if( srcMap == null )
return;
Set<String> keys = srcMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source source;
// Make sure the buffer m... |
efb6749a-7238-451c-9c8a-739dfc967da4 | 8 | public static void main(String[] args) {
Vector<Thread> threads = new Vector<Thread>();
String xmlFile = "/home/kircheis/Playground/github/ArmyAnt/conf/example.xml";
XmlParser xmlParser = new XmlParser(xmlFile);
// System.out.println("First Part");
// First, check the XML is valid or not.
if ( !xmlPar... |
ef5cb6d1-4d88-438b-aabd-c92b264bfacc | 4 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds((int)X, (int)Y)||apples.checkCollision((int)X, (int)Y))
{
if (apples.inBounds(X, Y))
{
apples.ground.destroyExpansion(X, Y,World.STONE, World.LAVA);//apples.ground.cellData[(int)X][(int)Y]
... |
a3d81c84-929e-42f0-889b-da5d6495f744 | 5 | public static CharsetEncoder createEncoder( String encodin ) {
Charset cs = Charset.forName(System.getProperty("file.encoding"));
CharsetEncoder encoder = cs.newEncoder();
if( cs.getClass().getName().equals("sun.nio.cs.MS1252") ) {
try {
// at least JDK1.4.2_... |
bbfb0786-9167-4b51-954e-afbd198fc994 | 7 | public static Recurso seleccionarPorCodigo(String id) throws SQLException {
ResultSet rs = null;
Libro libro = null;
Revista revista = null;
CdDvd cddvd = null;
PreparedStatement pstmt;
String queryLibro = "SELECT tipo, r.id, isbn, genero, titulo, fecha, num_ejemplar, ... |
cbdd2875-1be1-447f-a6f7-bd4f8fd576e1 | 1 | public static void main(String[] args) throws PropertyNotFoundException, IOException, InterruptedException {
// Initialize the beans to be used
injectBeans();
// Unmarshal validation rules from xml
initializeValidator();
// Add watcher and start listening for changes in the target folders
loadWatchersFrom... |
fe48cc9e-a155-4364-bc7f-b0d9cb991221 | 8 | public static Matrix multiplyThread(Matrix matrixA, Matrix matrixB) throws
IllegalSizesException, MatrixIndexOutOfBoundsException, IncorrectFormatOfData {
Matrix matrixC = null;
int rowsA = matrixA.getRowsCount();
int colsA = matrixA.getColsCount();
int rowsB = matrixB.getRo... |
3adb0473-59ed-47e3-a5cb-158242056897 | 7 | public void AddrModeDecl() throws ParseException {
Token n;
AddrModeDecl amd;
Property p;
List<AddrModeDecl.Operand> o;
FormatDecl e;
jj_consume_token(ADDR_MODE);
n = jj_consume_token(IDENTIFIER);
o = Operands();
amd = new AddrModeDecl(n, o);
... |
e8bd241f-924f-48b0-993f-d156913ef5e0 | 7 | public double extractDouble(String str) throws NumberFormatException
{
try
{
return Double.parseDouble(str);
}
finally
{
boolean r = true;
String d = "";
for (int i=0; i < str.length(); i++)
if (Character.isDigit(str.charAt(i)) || (str.charAt(i) == RAD_POI && r))
... |
03130521-0193-4bc1-8c9d-38f058ddf754 | 8 | public static LogicalConnector parseLogicalConnector(String s) throws ThinklabValidationException {
LogicalConnector value = null;
s = s.trim().toLowerCase();
// TODO support formal notation quantifiers too
if (s.equals("and") || s.equals("intersection"))
... |
3536d6d4-4d55-4fdf-8622-b2527e162897 | 5 | @SuppressWarnings("unchecked")
@Override
public void handleIt(Object... args) {
// Getting socket from passed arguments
sock = (Socket) args[0];
// Creating a GetOnlineUsersBean object to be written to the server.
GetOnlineUsersBean getOnlineUsersObject = new GetOnlineUsersBean();
try {
// Creating str... |
00c83504-bc24-4798-b96c-6b65ada0168d | 2 | boolean isInMovment() {
if (dx != 0 || dy != 0) {
return true;
}
else {
return false;
}
} |
0aeb6623-fe42-4aea-8e36-c50995418283 | 2 | private int blackDepth() {
int me = isBlack() ? 1 : 0;
if (hasLeftChild()) {
return me + getLeftChild().blackDepth();
} else {
return me;
}
} |
c0e55cc8-1b25-4ef3-af74-5ebb25f34da7 | 0 | @Override
public String toString() {
return firstName + " " + lastName;
} |
0de81fad-3d24-4456-98a2-04e24d0594b7 | 2 | void setStyle(FontStyle style) {
if (g.getFont() != style.font) {
g.setFont(style.font);
}
if (g.getColor() != style.color) {
g.setColor(style.color);
}
} |
883bcf73-8b1e-41eb-ba52-7fbaf060e80b | 6 | @Override
public void execute() {
if (Settings.itemTwoID != 0) {
int temp = Settings.itemTwoID;
Settings.itemTwoID = Settings.itemOneID;
Settings.itemOneID = temp;
}
if (Settings.itemOneID == 4698 || Settings.itemOneID == 243) {
Inventory.getItem(Settings.itemOneID).getWidgetChild().interact("Grind")... |
63cf467e-b7fc-4ad6-b502-c2eb470bd9a7 | 9 | private byte[] readName() throws IOException {
int nameLen = 0;
is.mark(1024);
int b = is.read();
for (; b != -1 && b != '\n'; nameLen++, b = is.read())
;
if (b == -1)
throw new EOFException("Unexpected end of fastq stream.");
is.reset();
byte[] name = null;
if (stripSegmentIndexFromReadName) {... |
5e8e0645-410f-4f18-8716-5631b4a9e333 | 5 | public static void removeItem(int itemID, int itemX, int itemY, int itemAmount) {
for (int i = 0; i <= 5000; i++) { // Phate: Loop through all item spots
if(globalItemID[i] == itemID && globalItemX[i] == itemX && globalItemY[i] == itemY && globalItemAmount[i] == itemAmount) {
removeItemAll(globalItemID[i], glo... |
1af6d4ad-b7ed-46b2-8fac-064f565f58a9 | 8 | public void openImage(String path, boolean tryLoadData){
// This may be a data file rather than an image.
dataPath = "";
boolean loadData = tryLoadData;
for (Parser p : filters.values()){
if (path.endsWith(p.getSuffix())){
dataPath = path;
loadData = true;
// Get image path from data fi... |
c63d7491-4797-4773-bed5-7d1c184d156f | 0 | public void setUitleningen(List<Uitlening> uitleningen) {
this.uitleningen = uitleningen;
} |
84e41527-835f-4176-849e-7a94398d735f | 4 | public int write(int index, char c, int count) throws Exception {
int counter = 0;
while(counter < count) {
//End of file reached
if(oft.getCurrentPosition(index) >= IOSystem.SIZE_OF_BLOCK_IN_BYTES * 3) { //If the pointer is the size of 3 blocks, we're done.
break;
}
if(oft.shouldReadNextBloc... |
ab4d3bce-5597-449c-a285-81147a7bd293 | 1 | public static void down() {
if(viewY + 100 < HEIGHT - 100) {
viewY += 1;
}
} |
e7656257-0cfb-4750-963b-0dc256ef7ea6 | 5 | private void processAddReplica(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] obj = (Object[]) ev.get_data();
if (obj == null)
{
System.out.println(super.get_name() +
".processAddReplica(): replica is null");
retu... |
6e70ae48-ea12-4716-b3a9-440dad6b81c1 | 0 | public void printDNA(){
System.out.println("dna" + dna);
} |
7c338b50-698a-4259-a3c2-4c5f10f15635 | 0 | public void setId(int id) {
this.id = id;
} |
22d4b50f-98a1-4faa-9955-6d82e2744db3 | 0 | private int getManhattanDistance(Tile start) {
return Math.abs(end.getX() - start.getX()) + Math.abs(end.getY() - start.getY());
} |
b62dca60-4824-47db-96ec-b2767d69c505 | 3 | public void fireAccountDataChanged() {
ArrayList<AccountType> types = new ArrayList<>();
for (AccountType type : selectedAccountTypes.keySet()) {
JCheckBox checkBox = boxes.get(type);
if (checkBox.isSelected()) {
types.add(type);
}
}
if... |
bab1d004-ca06-4ff2-bb54-142e19cc4b0f | 8 | private static boolean isOnlyEdge(StatEdge edge) {
Statement stat = edge.getDestination();
for (StatEdge ed : stat.getAllPredecessorEdges()) {
if (ed != edge) {
if (ed.getType() == StatEdge.TYPE_REGULAR) {
Statement source = ed.getSource();
if (source.type == Statement.TYPE_B... |
c0a0d0e8-698b-46ae-acc3-6f6303e9ef7c | 5 | public Client( ResourceContext rc ) {
this.resourceContext = rc;
sceneCanvas = new SceneCanvas(resourceContext);
sceneCanvas.setBackground(Color.BLACK);
cerealWorldIo = rc.getCerealWorldIo();
sceneCanvas.addOverlay(new UIOverlay() {
@Override public void draw(Graphics g, int width, int height) {
int y ... |
f4269f0a-66da-4fea-9d9c-50410a909554 | 8 | public void run(){
for (String[] args : moveFiles){
if (args.length != 2)
continue;
if (!checkAndMove(new File(args[0]), new File(args[1]))){
errored = true;
errorMessage = "Moving " + args[0] + " failed. Aborting install.";
Interface.onCompletion();
return;
}
}
f... |
dd3b6c6b-8a94-4979-b2ae-9a3d9115216a | 3 | public void menuCadastrarTurma(String disc, int num) {
try {
Disciplina dis = sistemaFrontEnd.pesquisaDisciplina(disc);
try {
dis.adicionaTurma(num);
front.exibirMsg("Turma Cadastrada");
} catch (TurmaJaExisteException e) {
front.exibirMsg("Essa turma já está cadastrada!");
}
} catch (Disci... |
494e01fe-c34f-4a85-b092-d8bfeccbac7b | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final GroupSales other = (GroupSales) obj;
if (!Objects.equals(this.typeGroup, other.typeGroup)) {
... |
c8571d25-d022-4a22-8ec0-6e9453c87296 | 2 | public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException
{
//calculate the offset of th
if(!isGameOver)
{
if(!isPause)
{
bmap.tmap.render(0, 0);
//temporary
g.draw(player.getCeilingPoly()... |
f12699d7-5f58-4e31-9b32-da6ad1e59f7d | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof Room))
{
final Room R=(Room)affected;
if((R.myResource()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_VEGETATION)
for(int m=0;m<R.numInhabitants();m++)
{
final MOB M=R.fetchInhabitant(m);... |
15364c16-e288-4355-a315-f27848e6705d | 6 | private boolean r_main_suffix() {
int among_var;
int v_1;
int v_2;
// (, line 36
// setlimit, line 37
v_1 = limit - cursor;
// tomark, line 37
if (cursor < I_p1)
{
... |
4af6d8ae-1a29-412d-a3e3-ba297354ce84 | 1 | public void makeDeclaration(Set done) {
if (constant != null) {
constant.makeDeclaration(done);
constant = constant.simplify();
}
} |
911c3f47-10d3-45fc-a8d4-2dad4c183d4e | 4 | private boolean[] effectVector(int x, int y, int width, int height) {
boolean[] a = new boolean[width * height];
a[x + y * width] = true;
if(valid(x - 1, y , width, height)) { a[(x - 1) + (y ) * width] = true; }
if(valid(x + 1, y , width, height)) { a[(x + 1) + (y ) * width] = true; }
if(valid(x ... |
b2215249-93ca-48e9-aac2-94f1e52c51b4 | 0 | public CheckResultMessage check11(int day) {
return checkReport.check11(day);
} |
8efb39dc-7b06-4bf3-b39e-23dba6bd541a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Application other = (Application) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return ... |
5c15193c-863a-43a4-a7d6-f950e0572fdf | 6 | public static void handleChannelDeleteEvent(ChannelDeleteEvent event)
{
Bukkit.getServer().getPluginManager().callEvent(event);
CommandSender channelDeleter = event.getDeleter();
ChatChannel channelToDelete = event.getChatChannel();
String channelDeleterName = channelToDelete.getName();
if (!event.isCancel... |
dc00d5cd-935c-4fee-8747-99013d831137 | 9 | private static AbstractMap.SimpleEntry<String, Type> processName(Method method) {
// preconditions
assert !CommonUtils.isEmpty(method) && !CommonUtils.isEmpty(method.getName()) : "Prosledjen je prazan method!";
String methodName = method.getName();
int paramCount = method.getParameterT... |
323e1d7f-b042-454f-8c61-925644064c1d | 3 | public URL getURL()
{
if( url == null )
{
// Check if the file is online or inside the JAR:
if( filename.matches( SoundSystemConfig.PREFIX_URL ) )
{
// Online
try
{
url = new URL( filename );
... |
f4aec7e8-2958-4d08-a717-4f1946bb3357 | 6 | public static void main(String[] args)
{
double temp;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a temperature, in Farenheit: ");
temp = keyboard.nextFloat();
DanielWherryFreezing tempTest = new DanielWherryFreezing(temp);
if(tempTest.isEthylFreezing() == true)
{
Syste... |
68f13536-0e40-4589-964b-0bd10947ad2a | 9 | public String interpret(String request) throws IOException {
String[] args = request.split(" ");
if (args[0].equals("DRAW")) {
int x1 = Integer.parseInt(args[1]);
int y1 = Integer.parseInt(args[2]);
int x2 = Integer.parseInt(args[3]);
int y2 = Int... |
0f020483-14cb-4822-bc75-e0bd8bc57b54 | 4 | public void visitCallStaticExpr(final CallStaticExpr expr) {
final Expr[] params = expr.params();
if (params.length > 0) {
params[0].visit(this);
}
if (!found && (exchangeFactor < 2) && (params.length > 1)) {
exchangeFactor++;
params[1].visit(this);
}
} |
4ca949db-8d1d-4943-9719-3620ec067409 | 5 | protected void checkResponse(HttpRequest request, HttpResponse response) {
boolean hasError = false;
try {
StatusLine status = response.getStatusLine();
int statusCode = status.getStatusCode();
if (statusCode == 404) {
hasError = true;
... |
441d9a48-a0d7-4ed7-97a9-04046211a0ae | 7 | private Exam parseExam(final Node exam) {
String name = "";
String mark = "";
final NodeList fields = exam.getChildNodes();
for (int i = 0; i < fields.getLength(); ++i) {
final Node field = fields.item(i);
if (field != null) {
if (field.getNodeType() == Node.ELEMENT_NODE) {
final Node item = fie... |
b86ade6d-0ea5-478f-8440-152e1d8cf905 | 7 | public void mouseClicked(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while (it.hasNext()) {
PComponent comp = it.next();
if (shouldHandleMouse) {
if (comp.shouldHandleMouse())
comp.mouseClicked(mouseEvent);
... |
b804f52a-0d6b-4344-af9c-6d8fc11a1db8 | 0 | public static void main(String[] args)
{
String a = "ABCD";
String b = a.toLowerCase();
b.replace('a', 'd');
b.replace('b', 'c');
System.out.println(b);
} |
cb68f510-167e-42de-a9b2-294852a6993f | 3 | public void setSize(int size) {
int lastPlusOne = mSelection.length();
if (size < 0) {
size = 0;
}
if (lastPlusOne >= size) {
mSelection.clear(size, lastPlusOne);
}
mSize = size;
if (mAnchor >= mSize) {
mAnchor = firstSelectedIndex();
}
} |
b0224e23-3ff1-429d-9157-30ae38586f72 | 9 | public void testMaybeExtractCountryCode() {
PhoneNumber number = new PhoneNumber();
PhoneMetadata metadata = phoneUtil.getMetadataForRegion(RegionCode.US);
// Note that for the US, the IDD is 011.
try {
String phoneNumber = "011112-3456789";
String strippedNumber = "123456789";
int cou... |
6ce695aa-ac2f-4cec-8566-e4a6afbd1f20 | 2 | public static boolean isBlank(String message)
{
if (message != null && !message.isEmpty())
return false;
else
return true;
} |
844a619c-eace-4cf0-81be-b0f5080bc93b | 5 | public void paintComponent(Graphics g) {
removeAll();
super.paintComponent(g);
// Traccio gli archi
Graphics2D g2 = (Graphics2D)g;
int startX, startY, endX, endY;
for (NodoGrafico ng: nodiGrafici) {
add(ng);
if (ng.destro() || ng.sinistro()) {
startX = ng.getX() + NodoGrafico.WIDTH / 2;
startY... |
8b394815-3611-43de-952f-576a5bec2040 | 5 | public void begin() {
final ObjectInputStream in;
final ObjectOutputStream out;
try {
in = new ObjectInputStream(socket.getInputStream());
out = new ObjectOutputStream(socket.getOutputStream());
Thread input = new Thread() {
@Override
public void run() {
while(true) {
readMessage(in)... |
e022b318-01c0-4779-bae9-fb125763a3ca | 7 | @Override
public boolean isLogLevel(LogLevel logLevel, boolean forAudit, Class<?> clazz) {
boolean result = false;
switch (logLevel) {
case DEBUG:
result = getLoggerOrAuditor(clazz, forAudit).isDebugEnabled();
break;
case ERROR:
result = getLogger(clazz).isErrorEnabled();
break;
case FATAL:
... |
0f1c0dc4-f188-4576-9cfb-6adb66726afc | 4 | @Override
public Product readObject() throws IOException {
Product readObject = null ;
if(!connectionInStatus){
startInputConnection();
}
if(connectionInStatus){
try{
readObject = (Product)is.readObject();
} catch (EOFException e){
return null;
} catch(ClassNotFoundException|IOException e... |
054da86a-ecf2-4302-ade7-2fe0c1839653 | 0 | public int getImgBitsPerPixel() {
return imgBitsPerPixel;
} |
22907a7c-452c-4014-a030-e40b042839a8 | 1 | public void editSongDialog() {
final Stage editSongStage = new Stage();
editSongStage.initModality(Modality.APPLICATION_MODAL);
editSongStage.initOwner(this.getScene().getWindow());
Label title = new Label("Choose a song:");
Button okay = new Button("Done");
okay.setOn... |
c11d8cd2-1705-492d-9815-ee0bfece1b3c | 7 | public static void WriteLog(String log){
String dat_time_path="";
StringBuilder sb = new StringBuilder();
try
{
try
{
Calendar cal = new GregorianCalendar();
String name_cal=new SimpleDateFormat("yyyyMMdd").format(cal.getTime());
... |
938fc4f6-b008-4dcd-80f5-47946cab1f65 | 9 | public static void uploadFile() throws IOException {
try {
logDirectory = new File("logs");
if ( !logDirectory.isDirectory() ) {
logDirectory.mkdir();
}
date = sdf.parse(sdf.format(new Date())).toString().replaceAll(" ", "").replaceAll("[0-9]+:[0-9]+:[0-9]+CDT", "");
Properties p... |
a90a53d1-7bca-4860-b7fc-2a295020d170 | 3 | private Transport createTransport(String name) {
logger.fine(String.format("creating transport '%s'", name));
Map<String, String> query = new HashMap<String, String>(this.query);
query.put("EIO", String.valueOf(Parser.protocol));
query.put("transport", name);
if (this.id != null... |
cc1b9825-cff8-41da-8b8c-31567078c9a5 | 9 | public void typeCheck(ExpressionVisitor visitor) throws XPathException {
GlobalVariable var = getCompiledVariable();
Expression value = var.getSelectExpression();
if (value != null) {
value.checkForUpdatingSubexpressions();
if (value.isUpdatingExpression()) {
... |
79a6e4f0-dd87-4645-942f-624c6b745f20 | 8 | public void step(int move) {
Point toMoveTo = null;
if (move == KeyEvent.VK_RIGHT)
toMoveTo = new Point(playerPos.x + 1, playerPos.y);
else if (move == KeyEvent.VK_LEFT)
toMoveTo = new Point(playerPos.x - 1, playerPos.y);
else if (move == KeyEvent.VK_DOWN)
... |
566e30dd-7823-4bbe-89e4-3322ab0e50c4 | 5 | @Override
public String toString() {
int i;
StringBuilder sb = new StringBuilder();
if (this.getMarks() != null) {
try {
if (average() != 0) {
sb.append(super.toString());
sb.append("\n\tPromotion: " + p.getName());
sb.append("\n\tId: ").append(id).append("\n\tMarks: ");
for (i = 0; ... |
9d4bc0c2-9b76-4bc0-b378-2ef033577431 | 7 | @Override
public void update(final Observable o, final Object arg) {
if (o instanceof ObservedChanges) {
if (this.type == TYPE.SELECTED) {
final ObservedChanges observedChanges = (ObservedChanges) o;
if (observedChanges.label.equals(CLABEL.SELECTED)) {
this.setText("");
if (observedChanges.... |
989715e2-3810-4ed6-95f6-fbd87d3933ea | 5 | public Solver(Board b2) {
this.b = b2;
while (!(b.isComplete())) {
for (int z = 0; z < 9; z++) {
for (int t = 0; t < 9; t++) {
// checks for available candidatess
b.availableCandidates(z, t, b);
}
}
}
for (int g = 0; g < 9; g++) {
for (int r = 0; r < 9; r++) {
// gets the boar... |
d87b6e99-2be3-419b-9d3f-34cace96a95d | 1 | public static boolean verifyPassword(String pass, Policy p){
if (p.isLegaelPass(pass))
return true;
return false;
} |
c12113d0-5dea-4419-ae1d-7028f0be412d | 5 | public Coordinates getNextAttack(boolean lastDidHit) throws CloneNotSupportedException {
Coordinates nextToHit = new Coordinates();
//next direction
if (lastDidHit == false) {
// reset
lasthit = new Coordinates(origin.getX(), origin.getY());
... |
0ee11b45-9cea-4841-a063-b885d9946cdd | 8 | @Command
public void post() {
if (isModify) {
if (content != null && content.length() > 0) {
artServ.updateModify(content, tags.get(tagSelectedIndex), bean.getId());
log.debug("EditorViewModel update Article by id:"+tagSelectedIndex+" on modify type");
Path.getComponent("//personalZul/personalContent"... |
5335110c-4589-41e8-a00e-8a7fb41a11b8 | 4 | @Override
public String execute(HttpServletRequest request, HttpServletResponse responce) {
try {
String xmlFilePath = fileManager.getFilePath(XML_FILE_NAME);
String xslFilePath = fileManager.getFilePath(XSL_ACTION_ADD_FILE_NAME);
Transformer transfo... |
89ab3429-9020-46f7-a2ea-f9db8fdca13b | 8 | @SuppressWarnings("serial")
public static boolean save(File filepath){
try{
if(filepath.exists()){
if(!Main.notifyOverwrite(filepath.getName())){
throw new UserException("User canceled overwrite"){};
}
filepath.renameTo(new File(filepath.toString() + "_OLD"));
filepath.createNewFile();
}... |
b0dd0a8e-ace1-4b6e-8aba-72dd976dfccd | 8 | public static void primeGen() {
// prepare array
for(int i=0; i<max; i++) numberPool[i]=false;
// tick off 0 and 1, so that following loops are simpler
numberPool[0]=true;
numberPool[1]=true;
// NB: in numberPool the false numbers end up being prime
for(int i=0; i<max; ++i) {
... |
33e2e08f-c82c-4c50-8f53-78f874d26571 | 1 | public static void writeFile(String savePath, String name, String content) {
String path = savePath + "/" + name;
try {
FileOutputStream fileOutputStream = new FileOutputStream(path);
PrintStream printStream = new PrintStream(fileOutputStream);
printStream.print(content);
printStream.close();
} catc... |
330f1c6a-58e0-4de4-a114-dd4ce9b31bd4 | 3 | private int getDirection() {
if(startY > getY()) { //true if checker moved up the board
if(startX < getX()) { //true if checker moved right
return 1;
} else {
return 2;
}
} else {
if(startX > getX()) {
re... |
b02f5be7-2b2f-46f3-9b4d-51716b59470f | 6 | public TCPClient() throws UnknownHostException, IOException{
System.out.println("Initializing TCP Client");
//import list of servers
servers = new ArrayList<ServerAddr>();
BufferedReader br;
try {
br = new BufferedReader(new FileReader("client_servers.txt"));
String line;
//read in servers.txt a... |
62a69ea8-ea7a-4c13-a36e-4e42c881186b | 6 | public static boolean isCachedObject(int objectX, int objectY, int objectHeight, int objectId)
{
for (StateObject so : stateChanges)
{
if(so == null)
continue;
if(so.getHeight() != objectHeight)
continue;
if(so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY)
retu... |
fd15be0f-b708-46fe-8603-030dc01846d4 | 0 | @Override
public DataStructures getStructure() {
return data;
} |
8edf9a96-6d08-4182-94e6-15d5e845e26a | 9 | public void run() {
// Make the run method a private matter
if(receiverThread != Thread.currentThread()) return;
try {
initializeLine();
int frameSizeInBytes = format.getFrameSize();
int bufferLengthInFrames = line.getBufferSize() / AudioStreamUDP.BUFFER_VS_... |
88bce7be-9612-4d57-ae1d-c9f8de7498a8 | 4 | public static void main(String[] args) {
String host = "";
int port = 0; // The port number
try {
host = args[0];
} catch (ArrayIndexOutOfBoundsException e) {
host = "localhost";
}
// **** Changed for E49' JI and KS
try {
port = Integer.parseInt(args[1]);
} catch (Exception e) {
port = DEF... |
48501106-5ceb-41c5-83ca-723c34998416 | 0 | @Test
public void runTestPrivateDataLeak2() throws IOException {
InfoflowResults res = analyzeAPKFile("AndroidSpecific_PrivateDataLeak2.apk");
Assert.assertEquals(1, res.size());
} |
d746bc4f-eb04-4001-993e-95e1641c28a3 | 0 | @Override
public void applyCurrentToApplication() {
// Synchronize default protocol in model.
Outliner.fileProtocolManager.synchronizeDefault();
Outliner.fileProtocolManager.synchonizeDefaultMenuItem();
} |
306a9370-0317-454e-9bde-d8e95dabb653 | 8 | @Override
public int compare(String str1, String str2) {
int i = 0;
int j = 0;
while (i < str1.length() && j < str2.length()) {
// locate number in first string
for (number1.setLength(0); isDigitAtIndex(str1, i); i++) {
number1.append(str1.charAt(i));... |
6d64d654-3150-46fd-8e2e-c8d04273d997 | 0 | public void upload(String from, String to) throws IOException {
fs.copyFromLocalFile(
new Path(from),
new Path(to));
} |
f90485e6-afc8-4d9b-b150-04cb7c9f0017 | 4 | private int numNeighbors( int[] n ) {
int result = 0;
if ( n[NORTH] != -1 ) {
result++;
}
if ( n[EAST] != -1 ) {
result++;
}
if ( n[SOUTH] != -1 ) {
result++;
}
if ( n[WEST] != -1 ) {
result++;
}
return result;
} |
ea8c388d-75d3-4758-bdb6-a5f81d40f911 | 4 | short[] findY1(short t1Index, short t2Index){
short pathT2Index = path[t2Index];
x1Dist = dist(pathT2Index, path[t1Index]);
short stopBefore = mod(t1Index - 2);
short start = mod(t2Index + 2);
int numLoops = Math.min(mod(stopBefore - start), LIMIT);
short t3Index = mod(start + random.nextInt(numLoops));
... |
8972f9ef-3ba7-489c-ab62-cc95f0ed8617 | 6 | private void startServer() {
parent.setClientSocket(socket);
InputStream is = null;
parent.append("> New Client: "+socket.getInetAddress().getHostAddress());
try {
is = socket.getInputStream();
in = new BufferedReader(new InputStreamReader(is));
} catch(IO... |
eb05aaab-af33-4df4-a79d-61e0ec4e795b | 1 | private String getDescription() {
String desc = "@MongoRemove(" + this.getParsedShell().getOriginalExpression() + ")";
if (!StringUtils.isEmpty(globalCollectionName)) {
desc = ",@MongoCollection(" + globalCollectionName + ")";
}
return desc;
} |
c5409693-072e-44c7-b864-ef374102d00e | 4 | @EventHandler
public void onCrazyPearlMove(PlayerMoveEvent pME) {
Player player = pME.getPlayer();
if(CrazyFeet.CrazyPearl.contains(player)) {
Location to = pME.getTo();
Location from = pME.getFrom();
Location loc = player.getLocation();
if(to.getX() != from.getBlockX() || to.getY() != fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.