method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
273ec11d-7513-4234-add0-c1015d1f880e | 6 | public static FileProxy findFileProxy(File file) {
String fullPath = PathUtils.getFullPath(file);
for (AppWindow window : AppWindow.getAllWindows()) {
if (window instanceof FileProxy) {
FileProxy proxy = (FileProxy) window;
File wFile = proxy.getBackingFile();
if (wFile != null) {
if (PathUtils.... |
85bdd492-0ea1-4a43-9947-95720a752041 | 1 | public void jump() {
if(! jumped){
speedY = -jumpStart;
jumped = true;
}
} |
633efe92-81b6-4c34-87b5-fe56381b4805 | 7 | @Override
public long power(long element, long exponent) {
isInField(element);
if (exponent < 0) {
throw new MathIllegalArgumentException("Cannot compute power with negative exponent!");
}
if (exponent == 0 && element != 0) {
return 1l;
}
if... |
dbb8122e-6bb6-42ad-903a-7a2a72ebb0ea | 5 | public void fire(int boatX, int boatY, int shotX, int shotY) {
Boat boat = getPlayerBoat(boatX, boatY);
if (boat != null && boat.getNbCoupRestant() > 0) {
try {
updater.addShot(new Shot(game, boat, shotX, shotY));
boat.decrNbCoupRestant();
noti... |
f69db9b9-960a-419d-b6ce-7e0f3de717aa | 3 | private String getSouth(char a) {
if ('0' == a) return "2, halt";
if ('1' == a) return "3, halt";
if ('2' == a) return "0, S";
return "1, S";
} |
f59f7f86-ed6b-483a-889a-eea6a9cdbccb | 8 | private void updateImg() {
int r,g,b;
for (int row = 0; row < 400; row++) {
for (int col = 0; col < 400; col++) {
r = (src.getRGB(col, row) >> 16) & 0xFF;
g = (src.getRGB(col, row) >> 8) & 0xFF;
b = src.getRGB(col, row) & 0xFF;
img.setRGB(col, row, (((r >= red_min && r <= red_max) ? r : 0)<... |
daf54347-9580-4fba-9423-450148388e53 | 8 | @Override
public boolean containsValue(Object val)
{
if (val == null) {
for (int idx = buckets.length - 1; idx != -1; idx--) {
MapEntry<K,V>[] bucket = buckets[idx];
for (int idx2 = bucketsizes[idx] - 1; idx2 != -1; idx2--) {
if (bucket[idx2].value == null) return true;
}
}
} else {
for ... |
dc7e5a86-5cc4-4b11-b3af-feac9df440ac | 9 | public static void computeEigenScoreLowMem(){
double dampFactor = 0.8;
int numIterations = 100;
double[] scoreOld = new double[population+1];
double[] scoreNew = new double[population+1];
HashMap<Integer,Integer> neighborWeight = new HashMap<Integer,Integer>(100);
for (int i = 0; i < scoreOld.length; i++){
... |
e2c1242e-2a85-4b42-836c-21030e2ff820 | 3 | boolean isPalindrome() {
Node reverse = this.reverseCopy();
Node n = this;
Node r = reverse;
if(n.data != r.data) {
return false;
}
while(n.next != null) {
n = n.next;
r = r.next;
if(n.data != r.data) {
... |
b038cfdf-90b1-454a-9cad-51c0dec2741c | 4 | public void testCollisionWhithEnemies(){
Iterator<Enemy> i = enemies.iterator();
while(i.hasNext()){
Enemy e = i.next();
if(player.getRect().intersects(e.getRect())){
player.hp = player.hp - 1;
i.remove();
}
}
if((playe... |
bdffc64e-7ed8-47a1-867f-9f201a6e3b87 | 5 | @Override
public List<Account> findAccountAll() {
List<Account> list = new ArrayList<Account>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT... |
7bb0d17c-77ea-4764-a094-0f4813c7b6d0 | 9 | @Override
public void execute(GraphModel graphModel, AttributeModel attributeModel) {
Graph graph = graphModel.getGraphVisible();
graph.readLock();
AttributeTable nodeTable = attributeModel.getNodeTable();
AttributeColumn erdosColumn = nodeTable.getColumn("erdosNumber");
i... |
9a1b944d-4528-4da3-bcec-a71f3a58bb3c | 3 | public double aprox(){
// We have p0
// Q1,1 = (x-x0)Q1,0 - (x-x1)Q0,0 / x1 - x0
// Row, Column
double[][] Q = new double[f.size()][f.size() + 1];
for(int i = 0; i < f.size(); i++){
Q[i][0] = f.get(i).y;
}
// Q[1][1] = ( ((pt - f.get(0).x) * Q[1][0]) - ((pt - f.get(1).x) * Q[0][0]) ) / (f.get(1... |
0982edc7-a0fe-4acc-be1e-ba582f34b42d | 7 | public void shutdown(){
acceptor.interrupt();
try {
System.out.println("Updating config");
Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
String ports = prop.getProperty(hostname);
if (ports != null && ports.contains(localPort)) {
System.out.pri... |
564da079-4cd5-4c50-b83f-16086a7a8ba1 | 9 | private void setValues(String key, Object value, @SuppressWarnings("rawtypes") Class clazz, ContentValues values){
if(clazz.equals(Integer.class))
values.put(key, (Integer)value);
else if(clazz.equals(Long.class))
values.put(key, (Long)value);
else if(clazz.equals(Boolean.class))
values.put(key, (Boolean... |
3949e35f-aa0d-433d-bb15-a35b82df23c9 | 5 | protected static String format(String[][] schedule, String name){
/* Style tag to make the table look pretty */
String out =
"<style>\n"
+ " p{\n"
+ " font: 22px helvetica, sans-serif;\n"
+ " font-weight: bold;\n"
+ " ... |
e60c2e7c-7dcd-4da4-af54-ce348bd34d54 | 8 | @Override
public void keyTyped(KeyEvent e) {
int KeyCode = e.getKeyCode();
if (KeyCode == KeyEvent.VK_A || KeyCode == KeyEvent.VK_LEFT) {
left = true;
}
if (KeyCode == KeyEvent.VK_D || KeyCode == KeyEvent.VK_RIGHT) {
right = true;
}
if (KeyCo... |
d9db340c-03f7-4b2c-9878-8f2ef55a8470 | 7 | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession s... |
0eec3d11-e5ed-4637-b1c1-5ce158529d19 | 4 | public void telechargerFichier() {
try {
// On crée les variables pour télécharger le fichier
URL adresse = new URL(url);
URLConnection connexion = adresse.openConnection();
int taille = connexion.getContentLength();
// On crée un flux d’entrée pour l... |
c3e64a7c-5bbb-4557-8d20-1513a6b417e0 | 1 | public void testConstructor_Object5() throws Throwable {
IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter("");
IntervalConverter conv = new IntervalConverter() {
public boolean isReadableInterval(Object object, Chronology chrono) {
return false;... |
b39a0da5-61f5-495e-9a98-677d82da2b58 | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
53ce45af-f02b-4d82-afde-7a3ed79e8f6a | 9 | public void set(int key, boolean down) {
int button = -1;
switch (key) {
case Keys.UP: button=UP; break;
case Keys.LEFT: button=LEFT; break;
case Keys.RIGHT: button=RIGHT; break;
case Keys.DOWN: button = DOWN; break;
case Keys.Z: button = Z; break;
case Keys.X: button = X; break;
case Keys.SHIFT... |
45f2370e-de0e-4328-bf30-0005af6fe303 | 1 | private static boolean deleteEmployee(Employee bean, PreparedStatement stmt) throws SQLException{
stmt.setString(1, bean.getUsername());
int affected=stmt.executeUpdate();
if(affected==1){
System.out.println("Employee with username "+bean.getUsername()+" has been Removed from database.");
} else {
... |
adcac45e-2c6a-4403-b5b7-2681bd986b6a | 3 | private void drawInventory()
{
for (int i = 0; i < this.itemList.size(); i++)
{
if (i > 1)
{
if (this.game.chestOpen)
{
this.game.fill(206, 188, 165);
}
else
{
this.game.fill(97, 90, 86);
}
}
MenuItem item = this.itemList.get(i);
this.game.text(item.getText(), item... |
93d95c08-899b-4013-9dd9-d02dbb936bc7 | 7 | public static Callable getElemFunctionAndThis(Object obj,
Object elem,
Context cx)
{
String s = toStringIdOrIndex(cx, elem);
if (s != null) {
return getPropFunctionAndThis(obj, s, cx);
... |
516c899b-aabe-4048-b14e-a26269dfeeaf | 6 | private static int positionSort(Point3D pos1, Point3D pos2)
{
if(pos1.getX() == pos2.getX())
{
if(pos1.getY() == pos2.getY())
{
if(pos1.getZ() == pos2.getZ())
return 0; //Same
else if(pos1.getZ() > pos2.getZ())
... |
12207179-362c-4664-b589-43d03e6cdc80 | 1 | public BeanMapper<?> getBeanMapper() {
return beanMapper;
} |
6f3ec8e0-fba7-4c7d-8b1a-ae565cbd8c91 | 0 | public void colorWhite() {
myColor = WHITE;
} |
a0efaf5b-4714-4ed4-b2ad-fb1897d8e4bb | 7 | @Override
public int[] sort(int[] target, boolean asc) {
boolean haveSwap = false;
int length = target.length;
if (asc) {
do {
haveSwap = false;
for (int i = 1; i < length; i++) {
if (target[i - 1] > target[i]) {
int tmp = target[i - 1];
target[i - 1] = target[i];
target[i] = ... |
5eb04e49-7e63-4569-a7a8-e936f9a6cf6e | 9 | public void newarray(Class<?> arrayType) {
assertTypeOnStack(StackEntryType.INT, "newarray requires int on stack");
int type = 0;
String desc;
if (arrayType == boolean.class) {
type = Opcode.T_BOOLEAN;
desc = "[Z";
} else if (arrayType == char.class) {
... |
779854a1-86ac-424e-ab8b-0b9b7fdc9822 | 1 | public CoordonneeJeu (int nombre_colonne, int nombre_rangee){
this.nombreColonne = nombre_colonne;
this.nombreRangee = nombre_rangee;
// Initialisation des coordonne (boolean default = false)
coordoneeJeu = new ArrayList<>();
for(int i=0; i<nombre_rangee; i++){
... |
0e2b2321-b38d-4a99-8e4a-f2c465285cca | 4 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "Only players may use this command");
return true;
}
if (arg... |
b667d54e-5975-424c-b80d-f6f814aeb556 | 4 | @Override
public boolean insert(String string) {
Node currentNode = root;
char c;
for (int i = 0; i < string.length(); i++) {
c = string.charAt(i);
if (c == '$') { //到序列末尾
if (currentNode.contains(c)) { //如果已有这个序列,则只要结点计数加1
currentNode.increaseCount();
}else {
Node leaf = new L... |
4c33a127-1732-4813-a98a-44647e3e9659 | 4 | public static boolean writeTextFile(String fileName, String content) {
try {
File f = new File(fileName);
if (f.exists() && !f.isDirectory() && f.canWrite()) {
FileWriter fw = new FileWriter(fileName);
BufferedWriter bw = new BufferedWriter(fw);
... |
9c6ac156-7e2b-4826-8dfa-8c2de1d2d1f0 | 3 | public List<String> getStringList()
{
List<String> a = new ArrayList<String>();
String b;
for (int i = 0; i < 999999; i++)
{
try {
b = fcw.getString(field + "." + i);
a.add(b);
} catch (NullPointerException e) {
breakCounter++;
if (breakCounter > BREAK_COUNTER_LIMIT)
return a... |
94ee5bba-4a3c-4a8e-bff5-8870d32c780a | 5 | private boolean mouseYinBlackArea ( int x, int y ) {
if ( y < 0 || x < 0 )
return true;
if ( y > ConfigurationData.getInstance ().getHeight () / 2 - 1 )
return false;
x = x % ( 3 * ConfigurationData.getInstance ().getEdge () );
if ( x < mapModel.slopeGap ( y )... |
25be4ea2-847d-4152-b45d-8e2402273ef9 | 5 | private static void parseBody(BufferedReader reader) throws IOException {
ArrayList<Integer> values = new ArrayList<Integer>();
ArrayList<Integer> weights = new ArrayList<Integer>();
String line;
// Creates the list for the elements
notInserted = new HashMap<Integer, Element>();
// Reads values
do {... |
e76dfad3-4777-47da-93cc-5bec92ab3464 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
59289208-6cb1-4264-90d7-27a094aa9179 | 4 | private boolean alertToDuplicates() {
for (String screen : mainProjectScreensCBL.getChecked()) {
if (secondProjectScreensCBL.getChecked().contains(screen)) {
JOptionPane.showMessageDialog(myCP, "You cannot select two screens with the "
+ "same name. Please uncheck one of the screens and re... |
f3efb78c-7381-4af2-9fee-af63a587ba0a | 6 | public Piece getLightKing(Tile[][] board, boolean isWhite)
{
Piece lightKing = null;
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
//If the space isn't null
if(board[j][i] != null && board[j][i].getPiece() != null)
{
//Get a piece with the name "K" (which should be a king)
... |
a0395aa2-bbbe-48dd-9db9-0e9e9a6a0f10 | 8 | private Indentation applyAutoIndentation(int offset, String str) throws BadLocationException {
// Prepare indentation container
Indentation indentation = new Indentation();
indentation.caretPos = -1; // Meaning that caret position is not changed
indentation.text = str;
// Apply auto indentation if it is ena... |
0a54535b-6691-4b2d-9d21-02b6737ea2c4 | 1 | public Component getTableCellRendererComponent(
JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int col)
{
// get the DefaultCellRenderer to give you the basic component
Component c = super.getTableCellRendererComponent(table, value, isSelected... |
2dab5c3d-a009-4152-b45f-00d4ea004631 | 1 | public Angle angle() {
double angle = Math.toDegrees(Math.atan(this.y / this.x));
if (y >= 0) angle += 90;
else angle -= 90;
return new Angle(angle);
} |
016f31ed-3875-4118-a461-ea95b3ae6e7d | 7 | public Map<Integer,Tile> cleanFloor()
{
//add current tile to visited list
visitedTiles.add(currentTile);
// Add unvisited surrounding tiles to unvisited tiles
surroundingTilesToUnvisted();
// Add current and surrounding tiles to internal map
internalMap = new HashMa... |
b2bf694f-1364-4939-ab1b-d6d76bc40f00 | 2 | private static boolean trunLeft(int n, int[] p){
String ns = Integer.toString(n);
while(ns.length()>1){
ns = ns.substring(1);
if (p[Integer.parseInt(ns)]==0) return false;
}
return true;
} |
2a5e2cb9-f93e-4e16-817e-1d85389322ed | 1 | public void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING)
System.exit(0);
} |
f7e9b53b-f7c0-4fa2-8d58-d30876c96cac | 8 | public static void testCorrectness(String sortName, IntSorter sorter, int iters)
{
System.out.println("\n\nTest" + sortName);
// Test behavior
for (int ii=1; ii<=iters; ii++)
{
System.out.println("\n\nCorrectness test "+ii);
final int[] array = new int[64];
... |
d115a8f9-ac4a-43e3-ac50-e88a666acc65 | 4 | private String scanTagUri (String name) {
StringBuilder chunks = new StringBuilder();
int length = 0;
char ch = peek(length);
while (STRANGE_CHAR.indexOf(ch) != -1) {
if ('%' == ch) {
chunks.append(prefixForward(length));
// forward(length);
length = 0;
chunks.append(scanUriEscapes(name));
... |
0fbcbf89-b6bb-4bae-8d90-16dad94ab541 | 3 | public void distributeNumberOfCardsToPlayers(List<Card> deck, HashMap<String, Player> players, int numberOfCardsPerPlayer) {
if (numberOfCardsPerPlayer <= deck.size() / players.size()) {
for (int i = 0; i < numberOfCardsPerPlayer; i++) {
Iterator<Map.Entry<String, Player>> iterator = p... |
2739e567-4c86-44c1-96a1-2051021cbc3c | 2 | public String processPerceptionAndGetNextStep(WumpusPerception perception) {
if (perception.getGlitter().equals(WumpusConsts.SENSOR_GLITTER))
return WumpusConsts.ACTION_GRAB;
else if (perception.getBump().equals(WumpusConsts.SENSOR_BUMP))
return WumpusConsts.ACTION_TURN_LEFT;
else
return WumpusConsts.AC... |
eeb2870f-0b0c-41dd-a385-728f0c33929f | 8 | @Override
public List<AdminCol> getColMetaList(String tblNm) {
log.debug("get column meta list for table = " + tblNm);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminCol> list = new ArrayList<AdminCol>();
StringBuilder sql = new StringBuilder();
sql.app... |
e8dd7e7b-9f34-4edb-b84f-a8d1abb2d3f6 | 2 | private boolean getDataBlock(int leafItemIndex){
// check for valid data block
if(leafItemIndex >= leafHitList.size())
return false;
// Perform a block read for indexed leaf item
leafHitItem = leafHitList.get(leafItemIndex);
// get the chromosome names associat... |
be909ee7-a73a-49dc-afee-53cca9b5a9fa | 7 | public void FeedBackAA(int Param) {
int SX, SY;
int PX, PY, DPX, DPY;
int Alpha, RD, GD, BD, RS, GS, BS;
int PixelDest, PixelSrc, PixelAlpha;
int ModColor, ModColor1, ModColor2;
int Temp[] = new int[256*256];
for(int i = 0; i < 256*256; ++i)
Temp[i] = Data[i];
ModColor1 = Color.HSBtoRGB(((float)(... |
d1b06f59-d72b-4799-ba47-021886e08ef1 | 7 | public boolean canMove(MoveDirection direction) {
Iterable<Point> iterable = pointIterator(direction);
for (Point candidate : iterable) {
boolean isRealPoint = !isEmpty(candidate.y, candidate.x);
if (!isRealPoint) {
continue;// discard 0's
}
int destY = candidate.y + direction.yAddition;
int des... |
16c93a70-ad6b-4cb8-8c27-59a2d153ec1c | 3 | public static void main( String[] argv ) {
try {
int sessionMaxAge = 10;
System.out.println( "Create a new map factory to use for the environment creation." );
ikrs.util.MapFactory<String,BasicType>
mapFactory = new ModelBasedMapFactory<String,BasicType>( new TreeMap<String... |
225e70de-3007-4832-b613-399b1041c102 | 1 | private void changeHost (String hostAndPort) throws UnknownHostException, IOException {
// Check the argument format
StringTokenizer strTokens = new StringTokenizer(hostAndPort, ":");
if(strTokens.countTokens() != 2) {
throw new IllegalArgumentException("Host:Port string not acceptable");
}
// Read the ... |
2a11fb04-78b7-40fe-9e28-655e9740ce98 | 8 | public static void main(String[] args) {
boolean flag = true;
int num1 = 0;
int num2 = 0;
String input = new String();
Scanner kb = new Scanner(System.in);
while (flag) {
try {
System.out.println ("Inserisci Un Numero Non Negativo");
input = kb.nextLine();
num1 = Integer.p... |
4fa56031-2996-4137-8fc1-9f4d9cf3c338 | 2 | @Override
public String toString() {
String strConfidence = this.actualConfidenceLevel+"";
int zeroes = 0;
if(strConfidence.length()!=5){
zeroes = 5 - strConfidence.length();
for(int i = 0; i < zeroes; i++){
strConfidence = strConfidence + "0";
}
}
return "IF " + this.antecedent.toStringW... |
d2472e8d-89c9-426d-8d0a-278f72117699 | 5 | public static void levelOrderTraversal(Node root)
{
int curlevel=0,nxtlevel=0;
int position=noOfNodes(root)/2;
if(root!=null)
{
q.add(root);
curlevel++;
while(!q.isEmpty())
{
Node temp=q.remove();
curlevel--;
System.out.print("\t"+temp.data);
if(temp.left!=null)
{
nxtlevel+... |
ed8e018a-59e2-47a0-9007-16445d962732 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Car)) {
return false;
}
Car other = (Car) object;
if ((this.id == null && other.id != null) || (this.id != null... |
d02b4017-5842-4775-bd09-b09500b613f0 | 8 | public Response newRequest(Request request) {
switch(request.type) {
case SETUP:
if(state != State.INIT)
return new Response(455, request.seq, session);
try {
video = new VideoStream(
Main.webroot + File.separator + request.url);
state = State.READY;
} catch(FileNotFoundException e... |
a2739f6c-62cd-4dc7-9388-fa87aa3137aa | 3 | private void updateFilePath()
{
try
{
targetDir = targetDir.getCanonicalFile();
}
catch(IOException e)
{
}
InstallerAction action = InstallerAction.CLIENT;
boolean valid = action.isPathValid(targetDir);
if(valid)
{
... |
0de9c21e-a129-448d-a9e3-87c051047e95 | 4 | public void moveSouth() throws InterruptedException{
if (isDoor[2] && !isLocked[2]){
currentY++;
currentRoom = rooms[currentY][currentX];
currentRoom.playerVisits();
setAdjacentRooms();
Game.printMessage("You walk through the southern door\n");
} else if (!isDoor[2])
Game.printMessage("There is no... |
d86bd5ac-8b8a-4f95-ba9d-1e47f957df8e | 4 | public static NondeterminismDetector getDetector(Automaton automaton) {
if (automaton instanceof automata.fsa.FiniteStateAutomaton)
return new FSANondeterminismDetector();
else if (automaton instanceof automata.pda.PushdownAutomaton)
return new PDANondeterminismDetector();
else if (automaton instanceof auto... |
f8d372c6-abdc-4ca7-9a41-30348244fc7c | 2 | public void mousePressed(MouseEvent arg0) {
if(options.isPrintMouseCoords()) {
System.out.println("Mouse was clicked: " + arg0.getPoint());
}
if(model.LOCKED) {
model.LOCKED = false;
model.getShop().hideDialog();
model.getPortal().setDialogVisible(false);
refreshView();
}
} |
cb8b1bea-8f93-4f2a-8225-66a47dc3f06d | 8 | @Test public void testReadWriteDeadlock() throws Exception {
System.out.println("testReadWriteDeadlock constructing deadlock:");
LockGrabber lg1Read = startGrabber(tid1, p0, Permissions.READ_ONLY);
LockGrabber lg2Read = startGrabber(tid2, p1, Permissions.READ_ONLY);
// allow read locks to acquire
... |
2a1ea80d-901d-4584-bea1-5836e3c0eaea | 4 | private static void dealKeyWordStr(String lineTxt) {
// TODO Auto-generated method stub
if (null == lineTxt || "".equals(lineTxt))
return;
String[] temp = lineTxt.split("[:]");
String key = temp[0];
ArrayList<String> valueList = new ArrayList<String>();
String[] valueTmp = temp[1].split(" ");
if (null... |
f1e42638-2aa3-4c6f-8a9c-a6fc81f6603d | 9 | @Override
public void serialize(IoBuffer buf) {
IoBufferUtils.putRS2String(buf, NameUtils.formatName(name));
IoBufferUtils.putRS2String(buf, password);
buf.put((byte) rights.toInteger());
buf.put((byte) (members ? 1 : 0));
buf.putShort((short) getLocation().getX());
buf.putShort((short) getLocation().getY(... |
81ed20da-7baf-4c11-ba38-af1edbac2f6a | 0 | public int pin() {
return(++pin_cnt);
} // end pin() |
cdf942f4-7eed-4f99-9b47-f1da2baaf3e2 | 4 | @Override
public String getTileUrl(int x, int y, int zoom)
{
int ty = y;
int tx = x;
// int width_in_tiles = (int)Math.pow(2,pyramid_top-zoom);
int width_in_tiles = getMapWidthInTilesAtZoom(zoom);
// System.out.println("width in tiles = " + width_in_tiles + " x = " + tx + " y = " + ty);
if (ty < 0)
{
... |
f786a867-5b85-4ac5-974c-66328f7d986a | 0 | public Game(Player player1, Player player2)
{
_player1 = player1;
_player2 = player2;
adjustConfigurations();
} |
3c950f2a-abba-4d83-ad32-5f86f6711492 | 2 | public static PublicationXref addBioPaxAttributes(
List<String> bioPaxRefId, String pubmedId) {
// create publicationXref object
PublicationXref xref = new PublicationXref();
if (!(bioPaxRefId.isEmpty())) xref.setId(bioPaxRefId.get(0));
else {xref.setId("");}
if (!(pubmedId.equals(""))) xref.setPubme... |
6d19c047-3e95-42b7-a450-5be54149aac9 | 0 | public static Preferences getPreferences()
{
return preferences;
} |
d91efb2d-6bc2-4dac-a761-94dc66a8817c | 5 | @Override
public List<Staff> findAll() {
List<Staff> listS = new ArrayList<Staff>();
Statement st = null;
ResultSet rs = null;
try {
st = this.connect().createStatement();
rs = st.executeQuery("select * from Staff");
System.out.println("recherche g... |
57c4e66c-3835-432c-82df-da9c5740bc62 | 8 | private boolean save() {
if(file == null) return saveAs();
Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(waitCursor);
TableItem[] items = table.getItems();
String[] lines = new String[items.length];
for(int i = 0; i < items.length; i++) {
String[] itemText = new String... |
ad1dc9f4-0f8b-496e-a589-9b572c16cadd | 3 | public static void helpMessage(Player player, String msg) {
String _msg = ruChat.cfg.getString("help-chat-format");
_msg = replaceSpecials(_msg, msg, player);
for (Player recipient : Bukkit.getOnlinePlayers()) {
if (ruChat.modes.get(recipient) == ChatMode.HELP || recipient.hasPermiss... |
995cb022-b803-4dce-adcd-c7f621c51d22 | 3 | public Card.Suit chooseSuit() {
Scanner sc = new Scanner(System.in);
String input;
System.out.print("Choose the suit you want to set (D, H, C, S): ");
while (true) {
input = sc.nextLine().toUpperCase().trim();
Card.Suit suit = Card.charToSuit(input.charAt(0));
if (suit != Card.Suit.INVALID && input.le... |
3d539291-9101-41dd-983f-09fe12348e89 | 1 | private synchronized static void createInstance() {
if (instance == null) {
instance = new Persistence();
}
} |
783a8cbb-4d67-40b9-98e4-40856c36932d | 9 | public void inscribir(Jugador unJugador, Partido unPartido){
//SI EL PARTIDO ESTA INCOMPLETO LO AGREGO SIN PROBLEMAS
if (unPartido.partidoIncompleto()){
unPartido.inscribir(unJugador);
}
//SI EL PARTIDO ESTA SEMICOMPLETO ME TENGO QUE FIJAR DE REEMPLAZAR A LOS SOLIDARIOS Y CONDICIONALES
//SE USA FOR POR... |
4bc97a7c-4e56-4aad-ad9f-573b026741ab | 1 | @Override
protected void observeInstructionCount(int instructionCount) {
if (stop) {
throw new StoppedExecutionException();
}
} |
305da388-a0ee-4f90-97ee-52646fac93ac | 3 | public static void main(String[] args) {
// Get user input for the file to print.
System.out.println("Enter the path to the file you wish to print: ");
Scanner Scan = new Scanner(System.in);
String File = Scan.nextLine();
// Create a file type for the inputted file.
... |
cc52ef41-c389-4b17-9f53-172089c1f9aa | 9 | private boolean isRegularType(Method method) {
return method.getReturnType().isEnum()
|| method.getReturnType().equals(Boolean.class)
|| method.getReturnType().equals(Character.class)
|| method.getReturnType().equals(Byte.class)
|| method.getReturnType().equals(Short.class)
|| method.getReturnType... |
290afa71-9c32-45fb-a147-467c1cf1d683 | 1 | public PhpposPeopleEntity getPhpposCustomersEntityFromCedula(long cedula){
logger.debug("cedula = " + cedula);
List<PhpposCustomersEntity> customersList = getHibernateTemplate().find(
"from PhpposCustomersEntity where accountNumber = ?", String.valueOf(cedula)
);
if (cust... |
74713ee0-cf99-4452-991f-f3d7bbfb1293 | 0 | @Test
@Ignore
public void testNoTestLinkAnnotationIgnore() {
assertTrue(false);
} |
9edede10-8c9e-43da-bb6f-5959feac96d5 | 8 | public final NTSParser.literal_return literal() throws RecognitionException {
NTSParser.literal_return retval = new NTSParser.literal_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token li=null;
Token lr=null;
NTSParser.boollit_return boollit161 = null... |
840ac8be-4a2c-4f4e-a699-19c58fba5173 | 2 | public void Login(String[] params){
if(params[0].equals("enes") && params[1].equals("enes")){
loginStatus = true;
} else{
loginStatus = false;
}
} |
6bc25803-c783-4f7b-824b-406433f85dfa | 5 | public static void main(String[] args) {
// insert a bunch of strings
String[] strings = { "it", "was", "the", "best", "of", "times", "it", "was", "the", "worst" };
IndexMinPQ<String> pq = new IndexMinPQ<String>(strings.length);
for (int i = 0; i < strings.length; i++) {
pq.... |
be601f8f-e808-4c2f-91fc-1bec363dd864 | 8 | public String getMessage(String s) {
if (s != null) {
int suchMessageNummer = Integer.parseInt(s);
String suchFile = "";
int count = 0;
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() ... |
87d7a4ec-9d33-4544-84bd-20935ed8e190 | 7 | public ColumnConstraints(String columnName, int columnType,
boolean[] tableConstraints, Boolean randomAllowed, boolean nullable, int maxSize, InstanceTester tester) {
this.name = columnName;
this.columnType = columnType;
this.maxSize = maxSize;
this.tester = tester;
constraints = new boolean[tableConstr... |
c818c976-6442-450b-93a7-da027b23c199 | 4 | public static IMapper getMapper(Type type)
{
switch (type) {
case ALBUM:
return new AlbumMapper();
case ARTIST:
return new ArtistMapper();
case TRACK:
return new TrackMapper();
case GENRE:
return ... |
5073f70d-23ab-4be2-bd6d-b4a1ea657381 | 5 | static final int method390(int i, int j, int k, boolean flag, int l, int i1, int j1) {
if (flag) {
aBoolean655 = true;
}
if ((1 & i1) == 1) {
int k1 = l;
l = i;
i = k1;
}
j1 &= 3;
if (j1 == 0) {
return k;
... |
a10be7ee-97ff-4270-9d0a-b30ddeaa63f7 | 4 | public static void main(String[] args) {
List<String> list = new CopyOnWriteArrayList<String>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
// get the iterator
Iterator<String> it = list.iterator();
//manipulate li... |
a48f0ea8-0180-44ca-854d-14edd41526c2 | 9 | public int caughtSpeeding(int speed, boolean isBirthday) {
if (isBirthday) {
if (speed <= 65)
return 0;
if (speed >= 66 && speed <= 85)
return 1;
if (speed >= 86)
return 2;
} else {
if (speed <= 60)
return 0;
if (speed >= 61 && speed <= 80)
return 1;
if (speed >= 81)
return... |
28aedeec-7d1b-4f36-bb4b-cc0686cdfd26 | 1 | public Background(String path) {
ImageLoader loader = new ImageLoader();
BufferedImage img = null;
try {
img = loader.load(path);
} catch (IOException exc) {
exc.printStackTrace();
}
ss = new SpriteSheet(path,Stubi.WINDX,Stubi.WINDY);
width = img.getWidth();
xMax = width - Stubi.WINDX;
} |
81142f3c-61c1-4e46-bdf0-02f2c337196b | 9 | public static String getNextId(String tablename){
int id=0;
String newId=null,role=null;
try{
Connection con=DBConnection.getConnection();
Statement stmt=con.createStatement();
//generate unique id
System.out.println("New Id technique implemented");
ResultSet rs=stmt.executeQuery("select max("+tabl... |
d6b03c32-0a14-4cd4-b522-d02cbcfcd951 | 4 | private void OnReceiveYt(String msg) {
if(state == GameState.PRE_FLOP){
OnPreflop();
}
if(state == GameState.FLOP){
OnFlop();
}
if(state == GameState.TURN){
OnTure();
}
if(state == GameState.RIVER){
OnRiver();
}
} |
3c55d789-d39a-4c22-8cb6-baa50c868134 | 3 | private static int checkTypeArgument(final String signature, int pos) {
// TypeArgument:
// * | ( ( + | - )? FieldTypeSignature )
char c = getChar(signature, pos);
if (c == '*') {
return pos + 1;
} else if (c == '+' || c == '-') {
pos++;
}
return checkFieldTypeSignature(signature, pos);
} |
600c0dc7-88a5-47a9-8569-9c9666fa5951 | 6 | private void merge(Node genNode, Node custNode) {
NodeList list = custNode.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node custChildNode = list.item(i);
if (custChildNode instanceof Text) {
continue;
}
Node genChildNode = getNode(genNode, custChildNode.get... |
23a4b405-a276-4290-a07a-90c658d5352f | 2 | public void genericMakeBlackMove(Move move){
int r1 = move.initialRow;
int c1 = move.initialCol;
int r2 = move.finalRow;
int c2 = move.finalCol;
if(Math.abs(r2-r1)==2 && Math.abs(c2-c1)==2){
CaptureWhitePiece(r1, c1, r2, c2);
}else{
... |
ed178bd7-8d7a-4ba1-ad3b-5dd56dbf9dac | 6 | private BigDecimal analizarTipoCliente(String codProducto,BigDecimal iva,BigDecimal sub,BigDecimal cantidad){
int sitFrenteIva=Integer.parseInt(field_situacion_IVA.getText());
BigDecimal impuestoInterno=calcularImpInterno(codProducto,sub,cantidad);
if((sitFrenteIva==3)||... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.