method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0a8f040d-4753-41d2-8c2a-2b8a3c14dd6e | 1 | private String calc(String input) {
//Person 4 put your implementation here
String output = "";
for (int i = 0; i < input.length(); i++) {
char current = input.charAt(i);
current ++;
output = output + current;
//fix
}
return output;
... |
7ea1f263-f002-4abc-95c3-e74d4406537f | 9 | public final JPoclASTParser.expr1_return expr1() throws RecognitionException {
JPoclASTParser.expr1_return retval = new JPoclASTParser.expr1_return();
retval.start = input.LT(1);
TypeTree root_0 = null;
Token set82=null;
JPoclASTParser.expr2_return expr281 =null;
JPoc... |
d4da5040-ef55-458d-9fd9-ad1fc187060e | 5 | public static void doButtonsActions() {
if (b1.isClicked) {
runMenu = false;
}
if (b3.isClicked) {
tb1.closed = false;
}
if (b4.isClicked) {
tb2.closed = false;
}
if (b5.isClicked) {
tb3.closed = false;
}
if (b6.isClicked) {
Engine.save();
}
} |
eb8d7868-7210-4ecf-8c24-99fcabf18cd1 | 5 | public static <E> FunctionExecutor<E> createPoll(final FeatureDefinition<? extends Property<? extends Queue<E>>> propertyDefinition) {
return new FunctionExecutor<E>() {
@Override
public E invoke(FunctionInvocation<E> invocation, Object... arguments) throws ExecutorInvocationException ... |
6bd0564f-c715-4457-bbbf-88e291605f89 | 3 | public int linearRegSlopeLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod-1;
} |
d8a975ee-f3c7-4863-b8b5-94d19b823408 | 6 | @EventHandler
public void SlimeJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.Jump.DodgeCha... |
3e26fda5-56e6-447c-9df1-cec00a2cc2bf | 9 | public void jarvisMarch(){
lines.clear();
currentHull.clear();
for (Point i : points){
i.usedYet = false;
}
Point max = new Point(0,0);
Point next = new Point(0,0);
int count = 0;
double angle = 360;
for(Point i : points){
if(i.getY()>max.getY()){
max = i;
}
}
currentHull.add(new... |
3d966ae5-e48c-4a2b-99da-f7910d922625 | 5 | public void paint1(Graphics g) {
if (oro != null){
if(instrucciones | pausa ) {
//muestra la imagen de instrucciones, sino la de pausa
if(instrucciones)
g.drawImage(background_instr, 0, 0, ANCHO, ALTO, this);
else
... |
972b0a81-bdc3-464f-a98d-9f05615e07c8 | 1 | @Override
public int hashCode() {
return playersName != null ? Arrays.hashCode(playersName) : 0;
} |
c5142d9a-4f46-4ba9-889b-f83c3d96326f | 4 | private int readAnnotationValues(int v, final char[] buf,
final boolean named, final AnnotationVisitor av) {
int i = readUnsignedShort(v);
v += 2;
if (named) {
for (; i > 0; --i) {
v = readAnnotationValue(v + 2, buf, readUTF8(v, buf), av);
}
... |
0d177a70-c9ad-424c-8d29-117a129989c9 | 5 | public void calculateZoomFrom(Set<GeoPosition> positions)
{
// u.p("calculating a zoom based on: ");
// u.p(positions);
if (positions.size() < 2)
{
return;
}
int zoom = getZoom();
Rectangle2D rect = generateBoundingRect(positions, zoom);
// Rectangle2D viewport = map.getViewportBounds();
int coun... |
a5bea0f3-2942-4f30-ad9c-bd36a4391d1e | 6 | public void testPut() {
Client client = new ClientImpl(TEST_HOST, TEST_PORT);
long jobId = client.put(65536, 0, 120, "testPut".getBytes());
assertTrue(jobId > 0);
client.delete(jobId);
// invalid priority
try {
jobId = client.put(-1, 0, 120, "testPutNegativePriority".getBytes());
client.delete(jobId... |
77bd4625-9a03-4fbc-9a8d-0c8898193c2e | 1 | public static Boolean ToggleQuestionValidation(int QDbId, boolean isValid)
{
String statement = String.format("Update question set isValidated = %s where QuestionID = %d", isValid ? "TRUE" : "FALSE", QDbId);
return runStatement(statement);
} |
b495f0f0-ae1d-4fb1-91f4-38975a685da9 | 0 | @Override
public double getHig() {
return hight;
} |
988f7cc9-218c-41f8-ae39-34039e530582 | 4 | protected static void passThrough( ZipFile zip, String fin, String fout ) throws IOException
{
try
{
java.io.File outfile = new java.io.File( fout );
// clean it up
outfile.deleteOnExit();
File dirs = outfile.getParentFile();
if( (dirs != null) && !dirs.exists() )
{
dirs.mkdirs();
dirs.d... |
a6612007-6b39-4617-9025-fdd9e04ccd2b | 4 | public int parseTerm() throws IOException {
Element localRoot = IRT.createElement(String.valueOf(Tags.TERM));
curRootElement.appendChild(localRoot);
curRootElement = localRoot;
int result = parseFactor();
//curToken = lexer.getToken();
while (curToken.type == DIVIDE ||
... |
490a20c8-3a0b-4762-a24c-b1b9c441edef | 3 | public static synchronized void sayString(String str){
if(null == str || str.isEmpty()){
System.out.println("String Error");
} else {
try {
URL word = new URL("http://translate.google.com/translate_tts?ie=utf-8&tl=en&q="+str);
HttpURLConnection connection = (HttpURLConnection) word.openConnection();
... |
19932e46-4c97-41c0-b5a0-c0677090f39b | 5 | public void save() {
String title = Tools.getLocalizedString(ActionType.SAVE.name()
+ ".Name");
String fonctions = program.getMainPanel().getTextField().getText();
try {
if (fileName == null) {
String file = Tools.showSaveDialog(title).getAbsolutePath();
if (!file.endsWith(".ks"))
file += ".ks... |
fd8e328c-9a35-4ed9-88a3-4e1618c0a276 | 0 | public void setSeqID(String seqID) {
this.seqID = seqID;
} |
f37efb5d-1b71-4ddf-9a50-a0934569935e | 3 | private List<Class<? extends IFilter>> getConfiguredFilters() {
//hardcode
LinkedList<Class<? extends IFilter>> filterClasses = new LinkedList<Class<? extends IFilter>>();
filterClasses.add(AFilter.class);
filterClasses.add(BFilter.class);
return filterClasses;
} |
cea40218-e416-49c2-8e2b-0af204433038 | 2 | private void removeAll(final boolean mark) {
if (mark) {
AbstractInsnNode insn = first;
while (insn != null) {
AbstractInsnNode next = insn.next;
insn.index = -1; // insn no longer belongs to an InsnList
insn.prev = null;
insn.next = null;
insn = next;
}
}
size = 0;
first = null;
... |
027942b5-ac8d-444a-baa6-e04f0ea8fb74 | 1 | public void initialize() throws SQLException {
if (conn != null)
{
dropTable("crmcorporationuserconnection");
dropTable("crmcorporations");
dropTable("crmavailabilities");
dropTable("crminterests");
dropTable("crmusers");
Statement stmt = conn.createStatement();
stmt.execute("CREATE TAB... |
19d206f4-05d3-4efa-a0c0-566867bcadb0 | 0 | public void skladanie(){
dysk = fabrykaPodzespolowLaptop.produkujemyDysk().dawajDysk();
grafika = fabrykaPodzespolowLaptop.produkujemyGrafike().dawajGrafike();
procesor = fabrykaPodzespolowLaptop.produkujemyProcesor().dawajProcesor();
ram = fabrykaPodzespolowLaptop.produkujemyRam().dawajRam();
chlodzenie = fa... |
19b7990e-c405-427f-8b5b-0d3600b1b80d | 5 | private List<String> getPatterns(String string) {
if (isValid(string)) {
List<String> patternList = new ArrayList<String>();
for (int i=0; i<string.length()-1; i++) {
if (string.charAt(i) == Pattern.ANY_CHAR && string.charAt(i+1) == Pattern.ANY_CHAR) {
String candidateString = string.substring(... |
9de07ebf-3c60-40bc-8edd-4f5ca3fdab0d | 4 | public synchronized boolean testarConexao(Connection con) throws SQLException{
boolean status = false;
boolean conectado = false;
if(KEEP_ALIVE){
ResultSet rs = con.createStatement().executeQuery("select 1 from crlv");
if(rs.next()){
status = true... |
009611c6-11c2-4fba-aec6-6ce472d2fc65 | 9 | private Location spawnAt(int width){
int currentx, currenty, tempx, tempy;
int length = 0;
currentx = tempx = getLocation().getCol();
currenty = tempy = getLocation().getRow();
while(!meetsSpawningCondition(currentx, currenty, width)){
length++;
for(int k = 1; k<=length; k++){
tempx=currentx-k;
... |
f2eb4fe1-087c-49e0-a9a0-4623684c2d14 | 5 | public boolean isFinished() {
if(!canStillMoveToAPlace(getActivePlayer(), getGrid()))
return true;
for (Player p : players) {
for (Player p2 : players) {
if (p2 != p && p.getPosition().equals(p2.getBeginPosition()))
return true;
}
}
return false;
} |
bc15bd50-1122-426c-8524-90f739b7a614 | 3 | public static void synchroniser(JCellule[][] grid, JLabel lblGeneration, JButton btnProchaineGeneration) {
double[][] opacites = ControllerGrille.grid.getOpacites();
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[0].length; j++) {
grid[i][j].setOpacite(opac... |
0e0204d4-8844-4cb3-a98c-0a0aef0e99b8 | 8 | @Override
public void move(final Doodle.Coordinates coordinates) throws GameEndedException {
final int iterations;
final double iterationVelocity;
final int hvCopy = hVelocity;
iterations = Math.abs(hVelocity);
iterationVelocity = (double) hVelocity / iterations;
f... |
a04ca384-39b2-40ae-a79f-adb96daeb60b | 9 | public static void main(String[] args) {
HereditaryProperty[][] bases = new HereditaryProperty[s.length][];
for (int i = 0; i < s.length; i++) {
bases[i] = new HereditaryProperty[s[i].length];
for (int j = 0; j < bases[i].length; j++) {
bases[i][j] = PermUtilities... |
8200ce07-2459-4d7a-94b3-b8a101298b75 | 7 | private void updateAllAQ() {
int c = movie.getCapacity();
for (int i = 0; i < numberOfAtoms; i++) {
try {
atom[i].updateAQ();
} catch (Exception e) {
atom[i].initializeAQ(c);
atom[i].updateAQ();
}
}
if (obstacles != null && !obstacles.isEmpty()) {
RectangularObstacle obs = null;
synch... |
00c53b49-7d51-456c-8731-1a92307bc8d6 | 5 | public static void drawHorizontalLineAlpha(int x, int y, int width, int colour, int alpha) {
if (x < topY || x >= bottomY)
return;
if (y < topX) {
width -= topX - y;
y = topX;
}
if (y + width > bottomX)
width = bottomX - y;
int opacity = 256 - alpha;
int r = (colour >> 16 & 0xff) * alpha;
int ... |
93d99ef5-09c5-40f0-8d8a-2cca724f703b | 4 | public void uimsg(String msg, Object... args) {
synchronized (ui) {
if (msg == "passwd") {
clear();
cur = new Pwbox((String) args[0], (Boolean) args[1]);
mklogin();
} else if (msg == "token") {
clear();
cur = new Tokenbox((String) args[0]);
mklogin();
} else if (msg == "error") {
... |
6a7e99bb-d90c-4bf9-b45b-5a8018f6329f | 5 | public static List<Integer> postorderTraversal(TreeNode root) {
List<TreeNode> stack = new ArrayList<TreeNode>();
List<Integer> res = new ArrayList<Integer>();
Map<TreeNode, Boolean> isFirstTraversal = new HashMap<TreeNode, Boolean>();
TreeNode node = root;
while (null != node || 0 != stack.size()) {
while... |
ba03189b-b1db-4174-97b1-3376f6cd5c46 | 3 | public void nextQueens(String[] board,int row,int n){
if(row >= n){
list.add(copy(board));
return ;
}
char[] crow = board[row].toCharArray();
for(int col=0; col< n;col++){
if(ok(board,row,col,n)){
crow[col] ='Q';
board[r... |
a3cc2f7b-711f-4055-9848-20f6a56b7ad0 | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = mapDestRect(destRect, 0);
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
... |
f51077cc-65a5-4bfa-9170-777e62624dec | 4 | private int jjMoveStringLiteralDfa2_3(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return 2;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return 2;
}
switch (curChar) {
case 93:
if ((active0 & 0x80000L) != 0L)
return jjStopAtPos(2, 19);
break;
... |
37006790-831a-493e-8e8a-80539d65e40f | 2 | protected void save(Path path) {
LinkedList<String> strings = new LinkedList<>();
String separator = System.getProperty("line.separator");
String entry = this.name + separator;
strings.add(SkinPreview.NAME.name() + SkinConstants.SPLIT + entry);
entry = this.author == null ? sep... |
bed49a38-dc34-4574-9511-950ff9b1435c | 3 | private boolean castlingFieldsInCheck(Field from, Field to, Player player) {
if (this.window.board.inCheck(player)) {
return true;
} else {
boolean castlingFieldInCheck = false;
Field castlingField = this.window.board.getField(from.file < to.file ? 'e' : 'c', from.rank);
Piece tempPiece = new King(playe... |
78796463-631f-4127-be15-4a4bae32fb1f | 0 | void sendRawLine(String line) {
OutputThread.sendRawLine(_bot, _bwriter, line);
} |
ccdf8187-0151-4144-86df-41cf80ba7aaf | 5 | public void act(){
HashMap<String, String> exits = context.getCurrentRoom(currentRoom).getExits();
Set<String> exitSet = exits.keySet();
int exitNum = 0;
String exit = null;
Random r = new Random();
boolean valid = false;
while(!valid){
exitNum = r.nextInt(exitSet.size());
... |
e58059a2-81a0-4523-bfec-5e4e6afb7a0e | 8 | protected double offset(double p1, double p2, double a1, double a2,
double b1, double b2)
{
double d = 0;
if (b1 <= p1 || p1 + a1 <= 0)
{
return 0;
}
double t = b1 * a2 - a1 * b2;
if (t > 0)
{
if (p1 < 0)
{
double s = p1 * a2;
d = s / a1 - p2;
}
else if (p1 > 0)
{
doub... |
a4d2bcbc-735a-40af-82e9-f4fecf8cad90 | 6 | @Override
public boolean containsKey(K key) {
for (Entry<K, V> entry : this.array) {
if (entry == null) {
continue;
}
if (entry.next == null) {
if (entry.key.equals(key)) {
return true;
}
} el... |
1164ac39-bf09-4cdb-8986-be67f116b3c5 | 8 | private void setCheckboxes(int right, JCheckBox cr, JCheckBox cw, JCheckBox cx) {
switch (right) {
case 0:
cx.setSelected(false);
cw.setSelected(false);
cr.setSelected(false);
break;
case 1:
cx.setSelected(true);
cw.setSelected(false);
cr.setSelected(false);
break;
case 2:
cx.setSelec... |
af082b37-978f-464d-a0ea-6460792556f7 | 2 | @EventHandler
public void onPlayerFireProjectile(ProjectileLaunchEvent e){
Projectile bullet = e.getEntity();
LivingEntity shooterLE = bullet.getShooter();
if(shooterLE instanceof Player == false) return;
Player shooter = (Player) shooterLE;
ItemStack item = shooter.getItemInHand();
Material m;
if(item =... |
531291e1-d584-4785-86b1-0b5e574027ac | 4 | private void AddUniform(String uniformName, String uniformType, HashMap<String, ArrayList<GLSLStruct>> structs)
{
boolean addThis = true;
ArrayList<GLSLStruct> structComponents = structs.get(uniformType);
if(structComponents != null)
{
addThis = false;
for(GLSLStruct struct : structComponents)
{
... |
c7a44759-86ef-4332-a88d-245c7744ab0d | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WithTooManyParameters that = (WithTooManyParameters) o;
if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return fals... |
03a2b27b-b61f-4356-b32a-b4ebe7a9cc15 | 8 | public String getProperty(String propKey) throws ServiceException
{
if(propKey.isEmpty())
return "";
if(!initialized) {
theLogger.log(Level.SEVERE, "Configuration Manager not yet Initialized");
throw new ServiceException("Configuration Manager not yet Initialized"... |
e433cbbb-70cd-4dd7-9651-cf7c19068231 | 4 | @SuppressWarnings("unchecked")
@Override
public double getScore(Object userAnswer) {
if (userAnswer == null)
return 0;
ArrayList<String> ans = (ArrayList<String>) userAnswer;
ArrayList<String> trueAns = (ArrayList<String>) answer;
ArrayList<String> ques = (ArrayList<String>) question;
int matches = 0;... |
ea47755b-0b43-4667-a6ff-e897c55aef92 | 2 | @SuppressWarnings("unchecked")
public FastHashTable(final int n, final int m, int k, final int w, final int word, final int bits) {
this.n = n;
this.m = Calc.m_fht(this.n) >> m;
this.w = w;
this.word = word;
k = k==0 ? Calc.k_bf(this.n, this.m) : k;
cbf = new CountingBloomFilter(this.m);
hash = new Uhash... |
df372020-838f-4872-9aa1-3b74d6462092 | 4 | @Override
public void run() {
try {
while(!Thread.interrupted()) {
synchronized(this) {
while(restaurant.meal != null) {
wait(); // ... for the meal to be taken
}
}
if(++count == 10) {... |
30dd83a7-4a28-40a5-8528-b02d3afa1d82 | 3 | public static void main(String[] args) {
Display display = new Display();
Shell shell = new AdvancedGraphics().open(display);
while (shell != null && !shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
} |
69b1ead4-d653-4f05-99ab-cd734c40a078 | 4 | public void calculateDiagonals() {
super.modelHeight = 0;
diagonal2DAboveOrigin = 0;
maxY = 0;
for (int vertex = 0; vertex < vertexCount; vertex++) {
int x = verticesX[vertex];
int y = verticesY[vertex];
int z = verticesZ[vertex];
if (-y > super.modelHeight)
super.modelHeight = -y;
if (y > ma... |
d401959a-7292-4ff0-ac21-8fe4834d1721 | 9 | String getFragment(int startPos, int endPos, String fileName) throws FileNotFoundException, IOException{
String docFragment = "";
RandomAccessFile doc = new RandomAccessFile(fileName, "r");
int aByte = 0;
doc.seek(startPos);
if(startPos != 0){
doc.seek(startP... |
17c4cdbb-9eba-4f38-95fe-adf2c2f3a007 | 2 | public String toString() {
String pixlimage = "";
for (int j = 0; j < height; ++j) {
for (int i = 0; i < width; ++i) {
pixlimage += pixel[j][i].red;
pixlimage += pixel[j][i].green;
pixlimage += pixel[j][i].blue;
pixlimage += '\t';
}
pixlimage += '\n';
}
return pixlimage;
} |
a36bec81-e808-4885-b693-0ee59e2a938f | 1 | public void init() {
for (int d=0; d<3; d++){
pos[d] = (int) Math.abs(Math.random() * 10);
}
System.out.format("Aircraft is at %s\n", IOGeneric.intListToString(pos));
} |
64aff168-bdda-4e3c-9580-49b07fbc8f64 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BauteilNr that = (BauteilNr) o;
if (n != null ? !n.equals(that.n) : that.n != null) return false;
return true;
} |
9c304935-8eb0-45e8-b849-9ea5eba85f9d | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
JWeb jWeb = (JWeb) o;
if (getId() != null ? !getId().equals(jWeb.getId()) : jWeb.getId() != null) return false;
if (getUrl() != null ? !getUrl(... |
d31f15e4-748e-467d-bbf2-54d5250b2483 | 3 | private boolean acceptDrag(DropTargetDragEvent event) {
int allowed = getPanel().getAllowedRowDropTypes();
if ((allowed & event.getDropAction()) == 0) {
if ((allowed & DnDConstants.ACTION_MOVE) != 0) {
event.acceptDrag(DnDConstants.ACTION_MOVE);
} else if ((allowed & DnDConstants.ACTION_COPY) != 0) {
... |
ec0e0a26-1bca-449b-8b2b-5f0f2f1676ea | 4 | public MethodNode method(MethodID id) {
ClassNode c = classes.get(id.owner);
if (c != null) {
for (Object mo : c.methods) {
MethodNode m = (MethodNode) mo;
if (m.name.equals(id.name) && m.desc.equals(id.desc)) {
return m;
}
}
}
return null;
} |
0fcebd09-e12b-4b09-9a41-d34ea84032b3 | 5 | @Override
protected Integer doInBackground() throws Exception {
publish("State 1 of 5: Collect files and directories! ");
for (int i=0; i<pathArray.length; i++){
find(pathArray[i]);
}
switch (searchMethod){
case SEARCH_ALL_DUP:
compareDirectories();
compareFiles();
break;
case SEARCH_DIR_D... |
c823a528-abd3-409f-ba40-de655ab014d5 | 5 | @Override
public void actionPerformed(ActionEvent e) {
JComponent source = (JComponent) (e.getSource());
if (source == (JComponent) interpolationmodeBox) {
plotComponent.setInterpolationMethod(interpolationmodeBox.getSelectedIndex());
}
else if(source == (JComponent) functionsBox) {
plotComponent.setF... |
588742dc-8df9-41bd-ab59-0c1139325c7d | 1 | private void rotateTicker() {
int barsCount = 11;
Area tempOuter = tickerOuter[0];
Area tempInner = tickerInner[barsCount - 1];
for (int i = 0; i < barsCount - 1; ++i) {
tickerOuter[i] = tickerOuter[i + 1];
tickerInner[barsCount - (i + 1)] = tickerInner[barsCount - (i + 2)];
}
tickerOuter[barsCount - ... |
aa8b5cdf-cafc-4f62-9121-bc65ce25dc8c | 0 | public static void main(String[] args) {
// Working with Queue's
Queue<String> line = new LinkedList<String>();
line.add("Person 1");
line.add("Person 2");
line.add("Person 3");
String person1 = line.remove();
String person2 = line.remove();
System.out.println(person1);
System.out.println(... |
056dca81-6b24-4b60-bcec-42259a11b211 | 3 | public ArrayList<Vector2> getSolidTiles(){
ArrayList<Vector2> result = new ArrayList<Vector2>();
for(int y = 0; y < worldHeight; y++){
for(int x = 0; x < worldWidth; x++){
Tile tile = Tile.getTileById(mapData.get((y * worldHeight) + x));
if(tile.isSolid){
result.add(new Vector2(x * tileSize,... |
f4e69dda-ced2-4f6c-9282-bdff117268fe | 5 | public void paintComponent(Graphics g) {
Graphics g2 = g.create();
Dimension d = getSize();
CPArtwork artwork = controller.getArtwork();
Object[] layers = artwork.getLayers();
g2.setColor(new Color(0x606060));
g2.fillRect(0, 0, d.width, d.height - layers.length * layerH);
g2.setColor(Color.black... |
48b60be8-bfd6-4aae-8f3f-1563c45d2811 | 4 | public int selectToEnd(boolean extend) {
if (mSize > 0) {
if (extend && !isEmpty()) {
if (mAnchor < 0) {
mAnchor = firstSelectedIndex();
}
select(mAnchor, mSize - 1, true);
} else {
select(mSize - 1, false);
}
return mSize - 1;
}
return -1;
} |
c3fada3e-3049-4420-9edc-c0ffb24c5d6b | 3 | public static String inet_ntop(long longValue) {
StringBuffer ip = new StringBuffer();
if (longValue<0) {
longValue=(long)(longValue+Math.pow(2, 32));
}
for (int i=3;i>=0;i--) {
ip.append((int)(longValue / Math.pow(256,i)));
longValue -= (int)(longValue / Math.pow(256,i))*Math.pow(256,i);
if (i>... |
d29baef0-6c33-48fe-9434-99739c9c97ae | 0 | public void setMACMethod(MACMethodType value) {
this.macMethod = value;
} |
55d48647-e596-4533-b31f-68f62b3cf37e | 5 | private Location secureLocation(Location oldLocation, Player player) {
World world = oldLocation.getWorld();
int x = oldLocation.getBlockX(), y = oldLocation.getBlockY(), z = oldLocation
.getBlockZ();
// Block for feet
Block blockOnY = world.getBlockAt(x, y, z);
// Block for head
Block blockOnY2 = wor... |
12946353-6859-4492-867b-1980f9269394 | 9 | static public void main(String[] args) {
// check command line arguments
if (args.length != 1) {
System.err.println("USAGE: java GameImageRecorder <directory>");
System.exit(1);
}
if (!(new File(args[0])).isDirectory()) {
System.err.println("ERROR: di... |
de38c555-9bc7-43e7-9272-c71ec0b7f864 | 4 | public String getRequestMessage(){
if(byteDatas.size() == 1){// 如果长度为1的话
this.message = CoderUtils.decode(ByteBuffer.wrap(byteDatas.get(0)));// 直接处理返回
}else if(byteDatas.size() > 1){
ByteBuffer buffer = null;// 缓冲区
if(this.dataPosition > BUFFER_LIMIT){// 收到的数据超过大小
buffer = ByteBuffer.allocateDirect(I... |
525c5df1-a129-4e4b-9e74-c583c6e354bb | 4 | @Test
public final void testUpdate() {
// Test that the update function can move a paddle.
Robot robot;
try {
robot = new Robot();
Field paddleField, directionField;
Paddle paddle;
// Check that direction starts at 0
{
... |
2210c1e5-20bd-4670-95e6-54bc4930c1e7 | 8 | public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed)
{
if(fixed)
{
xp -= xOffset;
yp -= yOffset;
}
for(int y = 0; y < sprite.getHeight(); y++)
{
int ya = y + yp;
for(int x = 0; x < sprite.getWidth(); x++)
{
int xa = x + xp;
if(xa < 0 || xa >= width || ya < 0 || ya >= ... |
9d0ddb4a-5ade-4076-b890-d481c821a979 | 4 | public MyUTMPoint toUTMPoint(double lat, double lon) {
if (lat < -80 || lat > 84) {
System.out.println("Latitude (" + lat + ") falls outside the UTM grid.");
}
if (lon == 180.0) {
lon = -180.0;
}
double UTM_F0 = 0.9996;
double a = 6378137.0;
double eSquared = 0.006694380004260827;
double l... |
91b3ed20-0f2b-4991-9674-506389160042 | 4 | @Test
public void testStraight(){
Hand FiveHigh = new Hand(new Card[]{new Card(Suit.DIAMONDS,14), new Card(Suit.SPADES,2), new Card(Suit.HEARTS,3), new Card(Suit.CLUBS,4), new Card(Suit.DIAMONDS,5)});
assertEquals(HandType.STRAIGHT,FiveHigh.getType());
Set<Hand> previous = new HashSet<Hand>();
previous.add(Fi... |
ae493d0b-0927-4b62-ab12-420e6ea02103 | 6 | public static int[][] insertZero(int a[][])
{
int[] row= new int[a.length];
int[] col= new int[a[0].length];
for(int i=0;i<a.length;i++)
{
for(int j=0;j<a[0].length;j++)
{
if(a[i][j]==0)
{
row[i]=1;
col[j]=1;
}
}
}
for(int i=0;i<a.length;i++)
{
for(int j=0;j<a[0].... |
0b69e3eb-9b10-4ce3-9a81-5525b6b146f3 | 0 | public void setItemId(int itemId) {
this.itemId = itemId;
} |
762920b0-4870-4e3d-9a2a-b6b03b3192d7 | 7 | public static void main(String[] args) {
double startLat = 41.82967; // constants
double startLong = -71.40210;
String ways;
String nodes;
String index;
String hostname;
int trafficport;
int serverport;
BackendWorker backend = null;
Map<String,Double> trafficData = null;
Server server... |
e7873cbc-32c5-40d5-b736-2905a0f7c39f | 9 | public int search(int[] A, int target) {
if (A == null || A.length == 0)
return -1;
int last = A.length - 1;
int start = 0, end = last;
int mid;
while (start <= end) {
mid = (start + end) / 2;
if (target == A[mid]) {
return mid;
} else if (target < A[mid]) {
if (A[mid] > A[last] && A[0]... |
a50e07c3-b631-4ba0-be08-6add6e496c75 | 7 | public void moveLEFT() {
x -= Bullet_SPEED;
if (x > 1800 || x<1 || y>900 || y<1){
//explode();
visible = false;
if(x > 1351 && y>396 && y<600){
GameArea.scoreamount++;
}
}
} |
aefcdfc1-0c2f-4b49-8917-6b4278852991 | 8 | static void SWAPK(int k, int k_max, BigInteger [][] b, BigInteger [][] H,
boolean []f, BigInteger [] d, BigInteger [][] lambda)
// the SWAPK procedure of algorithm 2.7.2
{
// System.out.println("SWAPK:");
// exchange H[k] and H[k-1]
// This can be done efficiently by swapping pointers... |
44a69a48-e3c3-4469-86c7-861c8e03173a | 5 | public boolean allVehiclesAreLegal(){
for(int row = 0; row < this.gridSize; row++){
for(int column = 0; column < this.gridSize; column++){
char current = this.grid[row][column];
//System.out.println("Current character: " + current + ", and current position: [" + row + ", " + column + "]");
int[] positi... |
738e7353-6792-4dee-88a8-4ac64bf69a74 | 1 | private boolean jj_3_75() {
if (jj_scan_token(NOT)) return true;
return false;
} |
ecb91901-838b-4046-b59f-e325f321a9b6 | 9 | @Override
public boolean move(short steps, Board gameBoard, short sid){
short gbSize = gameBoard.getBoardSize();
gbSize = (short)(gbSize*gbSize);
short currentSoldierStandingPoint;
short currentSoldierEndingPoint;
int chosenI = 0;
short distanceBetwee... |
b24faeb3-6fad-4a20-8f86-0ead6d57d00c | 6 | public String asString() throws WeiboException{
if(null == responseAsString){
BufferedReader br;
try {
InputStream stream = asStream();
if (null == stream) {
return null;
}
br = new BufferedReader(new Inp... |
244b7b62-9921-428d-a628-05cba199b415 | 5 | @Override
public void playbackStarted(PlaybackEvent playbackEvent) {
try {
if (fadeTime > 0.0f && fadeIn == null) {
stopFadeIn();
stopFadeOut();
setVolume(getMinGain());
if(gamePlayList != null) {
if(gamePlayList... |
ee74498b-ccfe-4069-b4a1-b3af70f633c1 | 0 | private void setInputsEnabled(Boolean enabled) {
inputTextArea.setEnabled(enabled);
sendButton.setEnabled(enabled);
statusOnline = enabled;
refreshTitle();
} |
59978663-13d2-4294-a740-82d07cb57bc7 | 1 | public void displayPage(String URL){
//String URL = "../../pages/help3.html";
try {
instructionPane.setPage(getClass().getResource(URL));
} catch (IOException ex) {
Logger.getLogger(HelpPanel.class.getName()).log(Level.SEVERE, null, ex);
}
} |
fd8d7db0-bbd4-4f47-9a57-96bb39f5eedc | 4 | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Invalid parameters number");
System.out.println("Usage:");
System.out.println("java ru.compscicenter.db.tolmachev.nosqldb.server.httpprotocol.DataBaseHttpServer <database server port>");
... |
6a7504e5-e90c-48f2-882e-9f2b542a14da | 4 | public void update(){
if(!isDead()){
if(getHealth() > 0){
if(isHostile && detectedPlayer){
moveToPlayer();
}else{
moveRandom();
}
}else{
die();
}
}
} |
a7d2b8e2-e53b-4df3-bc3f-8a0d499fe898 | 0 | public void setIdPosControlSaldos(int idPosControlSaldos) {
this.idPosControlSaldos = idPosControlSaldos;
} |
d32c447c-651a-4734-841e-362f64441563 | 5 | public void saveAdminPositions(){
if (customConfigurationFile == null) {
customConfigurationFile = new File(plugin.getDataFolder(), "blocklocations.yml");
}
customConfig = new YamlConfiguration();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (Location blockLoc : plugin.a... |
087368c6-abf3-4969-aae1-9018546d62c1 | 9 | public static ArrayList<EntityXML> inverseConvert(String fileName) {
ArrayList<EntityXML> entities = new ArrayList<EntityXML>();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document doc;
try {
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(new Fi... |
eaa78cce-1670-478a-95f8-ed92aca1d959 | 3 | @Override
public boolean validateAndStartFilePromote(PromotionFile pPromotionFile) {
FilePromoteStatus lFilePromoteStatus = getFilePromoteStatus(pPromotionFile, getDatabaseConnection().getLoggingConnection());
String lHashDifference = lFilePromoteStatus.mPreviousHash.equals(pPromotionFile.getFileHas... |
fdf704ae-9427-4a26-b1d7-def325e311ee | 8 | private boolean doitPrendrePassager(Passager p) {
/*int min = this.ascenseur.getNumEtageLePlusBas();
int max = this.ascenseur.getNumEtageLePlusHaut();
int etageTraite = this.getEtage().getNumero();
int etagePassager = p.getEtageDestination().getNumero();
return (etageTraite... |
ebd683b9-059e-4e33-8b3a-90eccb1e81bf | 8 | @Override
public void set(final LedColor... colors) {
int red = 0, green = 0, blue = 0;
for (final LedColor ledColor : colors) {
switch (ledColor) {
case RED:
red = 64;
break;
case YELLOW:
red = 64;
g... |
c5a51582-24c2-4cde-9180-5a01019e0225 | 7 | public void calculatePositions(Container target) {
if (rows.size() == 0) {
return;
}
//If we already calculated based on this target size then just return
if (lastTargetDim != null && target.getWidth() > 0 && target.getHeight() > 0) {
if (target.getWidth() == la... |
fb0b96c1-141c-4095-9d73-635d4e65e4fe | 2 | public void initializeClauses() {
splitStrings = splitter.splitClauses(this);
for (int i = 0; i < splitStrings.size(); i += 2) {
if (identifier.isClause(splitStrings.get(i), splitStrings.get(i + 1))) {
ArrayList<ArrayList<String>> clauseBundle = new ArrayList<>();
... |
47b8dc9b-7481-4c8c-9a58-786c6d1fdd45 | 0 | public List<SkillRating> getRequiredSkillRatings() {
return requiredSkillRatings;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.