method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
23d7d794-cb16-4a00-93f9-5e6d50859e66 | 5 | public static void drawVerticalLine(int x, int y, int h, int color) {
if (x < startX || x >= endX)
return;
if (y < startY) {
h -= startY - y;
y = startY;
}
if (y + h > endY)
h = endY - y;
int j1 = x + y * width;
for (int k1 = 0; k1 < h; k1++)
pixels[j1 + k1 * width] = color;
} |
e4db0815-3444-4109-a668-9093eef561fa | 7 | public static void avanzar(Cancha cancha, int equipo, int jugador, Pelota pelota){
float avance=cancha.getEquipoX(equipo).getJugadorX(jugador).getVelocidad();
avance=avance*Factorf.factorF();
int posX;
posX=cancha.getEquipoX(equipo).getJugadorX(jugador).getPosX();
... |
4cda6e2e-ca1a-4814-a617-362382376f42 | 8 | public boolean apply_wprime2w_edge_rule()
{
boolean changed = false;
ClosureOperation wop = null;
ClosureOperation wprime_op = null;
// 1) only the master process holds Read operations
for(BasicOperation bop : this.getProcess(masterPid).getOpList())
{
// 2) for each Read operation (R)
if(bop.isRead... |
723ab307-4977-458d-833f-c0fcadc7d0af | 5 | private static void merge(Comparable[] items, Comparable[] helper, int begin, int mid, int end) {
for (int i = begin; i <= end; i++) {
helper[i] = items[i];
}
int i = begin;
int j = mid + 1;
for (int k = begin; k <= end; k++) {
if (i > mid) {
... |
dcb28520-2418-44ff-b10e-299584e1f9af | 2 | private static void recibirCanales() {
try {
AudioChatService.recibirObjeto(getIn().readObject());
} catch (IOException e) {
throw new ConexionException("Error al recibir el objeto: "
+ e.getMessage(), e);
} catch (ClassNotFoundException e) {
throw new ConexionException("Error al recibir el objet... |
873ac796-ec65-46da-879d-c71863a3669f | 2 | public static void renderText(String text, float x, float y, float width, float z){
if(USED_FONT == null){
OutputUtility.outputLine("GameFontRender Error: font not set");
}
OpenGLTexture[] textures = USED_FONT.getText(text);
float char_width = width/((float)textures.length... |
863702f9-d268-4bec-a03a-dd1ff6c5378e | 9 | public static void loadText(String file) {
Scanner s = null;
InputStream is = Text.class.getResourceAsStream("/shoddybattleclient/languages/" + file);
try {
s = new Scanner(is);
} catch (Exception e) {
System.err.println("Failed to load language file");
... |
4b1c0cf5-a7ce-4266-b6d4-39bbeee72f52 | 2 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
if (e.getDocument() == null) {
setEnabled(false);
} else {
JoeTree tree = e.getDocument().getTree();
if (tree.getComponentFocus() == OutlineLayoutManager.ICON) {
setEnabled(true);
} else {
setEnabled(false);
... |
020fd1d2-8b09-43df-b2a8-92594643c6fd | 7 | @Override
public void OpenDoors() {
int dir = getMyDirection();
int flr = getFloor();
if (dir == DIRECTION_UP && myUpBarriers[flr].waiters() > 0) {
// System.out.println("Waking up " + myUpBarriers[flr].waiters() +
// " on floor " + myFloor);
myUpBarriers[flr].raise();
}
if (dir == DIRECTION_DOWN &&... |
0f03f478-0b7e-4447-969a-6952fcda6c54 | 6 | public void load(TaggedStorageChunk chunk)
{
this.cookedTime = chunk.getInteger("cookedTime");
this.burnTime = chunk.getInteger("burnTime");
if(chunk.hasTag("inID") && chunk.hasTag("innbr"))
{
this.in = new ItemStack(Item.get(chunk.getString("inID")), chunk.getInteger("innbr"));
}
if(chunk.hasTag(... |
06a1da30-8d8a-473b-889f-8820d85a6c40 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if (mIsRunning) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
repaint();
}
});
mAngle += 3;
if (mAngle >= 3... |
7fef4107-fbfe-4ea6-b8ff-c254a0338525 | 7 | public void multiplyBy(double factor, int cx, int cy, int radius) {
int ci = getI(cx);
int cj = getJ(cy);
int iradius = getI(radius);
for (int i = ci - iradius; i < ci + iradius; i++) {
for (int j = cj - iradius; j < cj + iradius; j++) {
if (i < 0 || j < 0 || i >= voxels.length
|| j >= voxels[0].l... |
bef5a4ff-785e-47d4-8b93-b4c3e604bac9 | 8 | private static String encode(String value) {
String encoded = null;
try {
encoded = URLEncoder.encode(value, HTTP_ENCODING);
} catch (UnsupportedEncodingException ignore) {
}
StringBuilder buffer = new StringBuilder(encoded.length());
char focus;
for (int i = 0; i < encoded.length(); i++) {
focus = ... |
1544a451-3c50-4574-9a4d-d52389b41547 | 2 | public double maxProbability(int x_i) {
int n = potentials.chainLength();
int k = potentials.numXValues();
double best = Double.NEGATIVE_INFINITY;
double current = 0;
for (int v = 1 ; v <= k ; v++) {
current = messageFactor2Node(n,n,v) + messageFactor2Node(2*n-1,n,v);
if (current > best) {
best =... |
4dfe4c14-00de-400d-9e8a-b155b56ce7a3 | 0 | public void setMsgContent(byte[] msgContent) {
MsgContent = msgContent;
} |
29361d52-ddbe-4026-b820-5ba046af5dbd | 8 | public boolean pickAndExecuteAnAction() {
synchronized (indecisiveCustomers) {
for (DavidCustomerRole cust : indecisiveCustomers) {
cust.msgAvailability(getAvailability());
indecisiveCustomers.remove(cust);
return true;
}
}
for (Table table : DavidRestaurant.tables) {
if (!table.isOccupied(... |
2484bf5f-cd71-469c-91e8-a4aab7c7c697 | 9 | public String getLecturaPrimitivaJava() {
if (nombre.equals("String")) {
return "in.nextLine()";
}
if (nombre.equals("int")) {
return "in.nextInt()";
}
if (nombre.equals("float")) {
return "in.nextFloat()";
}
if (nombre.equals("... |
7cd9c0ad-6e45-4a7e-a2c9-68203c04642e | 0 | public int getRandomNumber(int min, int max) {
return (int) Math.floor(Math.random() * (max - min + 1)) + min;
} |
b81877ad-5bcf-4b0b-994b-d527cf763c76 | 2 | @Override
public boolean verificaAcesso(Funcionario funcionario) {
try {
conn = ConnectionFactory.getConnection();
String sql = "SELECT * "
+ " FROM funcionario "
+ " JOIN acesso ON funcionario.idacesso = acesso.id "
... |
945165c9-c087-4969-8e0e-a24e1615a90c | 2 | public RaavareBatchDTO getRaavareBatch(int rbId) throws DALException {
ResultSet rs = Connector.doQuery("SELECT * FROM raavarebatch WHERE rb_id = " + rbId);
try {
if (!rs.first()) throw new DALException("Raavarebatchen " + rbId + " findes ikke");
return new RaavareBatchDTO (rs.getInt(1), rs.getInt(2)... |
dc14bcdd-6162-488d-b37a-1a192495def3 | 8 | public double side(Box box) {
final Point2DInt corners[] = box.getCorners();
final double s0 = side(corners[0]);
final double s1 = side(corners[1]);
final double s2 = side(corners[2]);
final double s3 = side(corners[3]);
if (s0 > 0 && s1 > 0 && s2 > 0 && s3 > 0) {
return 1;
}
if (s0 < 0 && s1 < 0 && ... |
ee1026ad-5682-4323-b445-6f626c6633cc | 9 | @Override
public void endElement(String uri, String localName, String name) throws SAXException {
if (name.equalsIgnoreCase("gameName")) {
gameName = currentValue;
}
if (isAchievement) {
if (name.equalsIgnoreCase("iconClosed")) {
currentA.setIconOpenU... |
775696d8-970f-4377-8bfd-6bd64a2a726e | 4 | public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) {
NBTTagCompound var3 = var1.getNBTTagCompoundWithPlayer(var2);
NBTTagCompound var4 = new NBTTagCompound();
var4.setTag("Data", var3);
try {
File var5 = new File(this.saveDirectory, "level.dat_new");
File var6 = new... |
f56b561f-5728-4369-bd76-dfda0053f2e0 | 3 | @Override
public EntidadBancaria get(int id) {
PreparedStatement preparedStatement;
EntidadBancaria entidadBancaria;
ResultSet resultSet;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("SELECT * FRO... |
07dc1e41-e860-4ee1-a2d2-65ab54b219a4 | 7 | public static Message parse(String message) {
switch(Message.parseType(message)) {
case ID_REQUEST:
return new IdRequestMessage().decode(message);
case ID_RESPONSE:
return new IdResponseMessage().decode(message);
case SPAWN:
return new SpawnMessage().decode(message);
case DESPAWN:
return n... |
ead7632d-7a3b-4f6e-8935-e82616b169c8 | 0 | public boolean getObtained() {
return this.obtained;
} |
4ecfbcab-2848-4c76-8367-336f54e4a4d9 | 1 | public boolean writeStore(ReservationStation resStation, String result) {
if (resStation.getQk() == null) {
String b = resStation.getDest();
ROB.updateValue(Integer.parseInt(b), result);
return true;
}
return false;
} |
6021c58a-5f92-4093-9767-c80b142bf475 | 1 | protected static BmUrlManager getBmUrlManager() {
if (bmUrlManager == null)
bmUrlManager = new BmUrlManager();
return bmUrlManager;
} |
0f7b411c-2de6-4154-bdec-cb650911045a | 5 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||life--<0)
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
if (!apples.isSolid(X, Y-10))
{
Y-=10;
}
for (int i = 1; i < 10; i++)
{
if (... |
3b926d00-9507-4d76-8280-6cad03ad2a68 | 2 | @Override
public void end(String nick){
if(end == false){
end = true;
if(!nick.equals("computer")) {
Player p = em.find(Player.class, nick);
p.setScore();
em.merge(p);
}
}
} |
67978c07-8ac9-4134-9736-9239865b063a | 4 | public static boolean intersects( String rng, int[] rc )
{
int[] rc2 = getRangeCoords( rng );
if( (rc[0] >= rc2[0]) && (rc[2] <= rc2[2]) && (rc[1] >= rc2[1]) && (rc[3] <= rc2[3]) )
{
return true;
}
return false;
} |
43af9069-0af2-43b5-8584-3f765d565137 | 2 | public List<Cliente> listar() {
String sql = "SELECT * FROM CLIENTE";
try {
conn = GerenciaConexaoBD.getInstance().getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
List<Cliente> listaCliente = new ArrayList<Cliente>();
while (rs.next()... |
9285976e-c0bd-4c4b-b35c-12ec81e80fcb | 7 | public double calcUntersumme()
{
double hoehe, erg;
erg = 0.0;
for(double i=intervalLeft; i<=intervalRight-dx+(dx/4); i+=dx)
{
int j1, j2;
j1 = 0;
while(points.get(j1).getX()<=i && j1 < points.size()-1)
{
j1++;
}
j2 = j1;
while(points.get(j2).getX()<=i+dx && j2... |
de44d922-dd94-4177-b8ed-514072fdb8d0 | 0 | public CheckboxListener(JCheckBox checkbox, Preference pref) {
setCheckBox(checkbox);
setPreference(pref);
} |
ae5b2134-a448-460c-8b3f-3263ace62eb1 | 6 | public void tableau_manuel_suivant()
{
tcon.gridy=tcompteur++;
float max =0;
for(int i=1;i<data.get(0).size();i++)
{
if(Float.parseFloat(data.lastElement().get(i))>max)
max = Float.parseFloat(data.la... |
a5d99951-7932-4bcd-b38c-9391c24024e5 | 9 | @Override
public void setMiscText(String newText)
{
super.setMiscText(newText);
operation = null;
mask=null;
selfXP=false;
String s=newText.trim();
int x=s.indexOf(';');
if(x>=0)
{
mask=CMLib.masking().getPreCompiledMask(s.substring(x+1).trim());
s=s.substring(0,x).trim();
}
x=s.indexOf("SEL... |
625cae09-3120-4e1c-ac68-d8f34bde7e73 | 8 | @Override
public Rectangle getBoundingBox() {
int smallestx = Integer.MAX_VALUE;
int smallesty = Integer.MAX_VALUE;
int biggesty = Integer.MIN_VALUE;
int biggestx = Integer.MIN_VALUE;
for (int i = 0; i <= px.length - 1; i++) {
if (px[i] < smallestx) {
smallestx = px[i];
}
}
for (int i = 0; i <=... |
2a7f7b77-3d6c-47de-a122-c267b767d313 | 1 | public void paint(Graphics g) {
g.drawImage(image, 0, 0, this);
// Notify method splash that the window
// has been painted.
// Note: To improve performance we do not enter
// the synchronized block unless we have to.
if (! paintCalled) {
paintCalled ... |
f71e9d31-e4b4-4424-af29-7f88f3981e04 | 4 | private final static BitPayResponse toBitPayResponse(Invoice invoice) {
BitPayResponse response = new BitPayResponse();
if (invoice == null) return response;
response.btcPrice = invoice.getBtcPrice();
response.status = invoice.getStatus();
response.price = invoice.getPrice();
... |
26034a68-8004-4d7d-9df2-fd56b7c85c67 | 6 | public static void addBuff(Unit owner, Unit target, Buff buff) {
if (owner != null && target != null && buff != null) {
// check if buff already had a target -> if so then remove the buff from the current target
if (buff.getTarget() != null)
GameLogic.INSTANCE.removeBuff(buff.getTarget(), buff);
// set ... |
3001ef5a-ba93-4c08-8e4a-bb8069ec6e36 | 8 | * @param sizecutoff
*/
public static void printExtensionSizes(Module module, int sizecutoff) {
if (sizecutoff == Stella.NULL_INTEGER) {
sizecutoff = 10;
}
if (module == null) {
module = ((Module)(Stella.$MODULE$.get()));
}
{ List descriptions = List.newList();
String size = nu... |
164ffeb2-36c4-4fdc-90d8-6128b742a75f | 8 | static void next_move(int posr, int posc, int dimh, int dimw, String[] board) {
char[][] chars = new char[board.length][board[0].length()];
for (int i = 0; i < board.length; i++) {
chars[i] = board[i].toCharArray();
}
String ret = null;
if (chars[posr][posc] == 'd') ... |
77ea77e5-400b-441a-b253-ef417e8cd18d | 3 | public static Mask buildLogMask(int size, double sigma) {
if (size % 2 == 0) {
size++;
}
Mask mask = new Mask(size);
for (int i = -mask.getWidth() / 2; i <= mask.getWidth() / 2; i++) {
for (int j = -mask.getHeight() / 2; j <= mask.getHeight() / 2; j++) {
//1/(sqrt(2*pi)*sigma^3)
dou... |
35fb3889-4379-489b-85e2-424f43f1e238 | 5 | public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setSize(WIDTH, HEIGHT);
frame.setTitle("AsteroidTester");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Random r = new Random();
ArrayList<Asteroid> asteroidList = ne... |
72e67271-cad2-46aa-a3a2-0e1b88f4e183 | 9 | public static void addItem(Hero owner, Item item) {
if (owner != null && item != null && !owner.equals(item.getOwner())) {
item.setOwner(owner);
switch (item.getCategory()) {
case CONSUMABLE: {
// add item to pouch
owner.getPouch().add(item);
if (LOGGER.isDebugEnabled())
LOGGER.debug("S... |
2a80036d-d3ee-4da9-976f-691ef470ab92 | 3 | private void report(String name, double value, Hashtable attributes) {
Frame frame = new Frame(name);
Label label = null;
// Resize the frame so it can contain all the text.
// XXXX Ideally we need to find the longest property and resize horizontally as well.
i... |
122fe66c-7944-4080-8f0a-96557699f3e2 | 4 | public Expression(String expression) {
this.expression = expression;
addOperator(new Operator("+", 20, true) {
@Override
public BigDecimal eval(BigDecimal v1, BigDecimal v2) {
return v1.add(v2, mc);
}
});
addOperator(new Operator("-", 20, true) {
@Override
public BigDecimal eval(BigDecimal v1... |
91cbb231-d1c6-4b95-9808-b42f16eb5ce2 | 9 | private void initialize( String h, int p, String n )
{
if ( h == null )
{
throw new IllegalArgumentException( "Hostname cannot be null" );
}
if ( "".equals( h ) )
{
throw new IllegalArgumentException( "Hostname cannot be empty" );
}
if ... |
51f4641c-ccd1-4d6a-8959-319f64b24726 | 7 | public static void numDecodingsHelper(String s, int[] helper, String last) {
if (s.length() == 0)
return;
boolean flag = false;
String newLast;
if (s.length() >= 2) {
if (Integer.parseInt(s.substring(1, 2)) == 0) {
helper[0]++;
numDecodingsHelper(s.substring(2), helper, s.substring(1, 2));
} el... |
257d7079-396a-4b4a-968d-6cb2a77b9fc3 | 0 | public void setIdTpv(int idTpv) {
this.idTpv = idTpv;
} |
63821ac1-680a-4c59-a7c3-8b4d0a6539b3 | 7 | void menuOpenURL() {
animate = false; // stop any animation in progress
// Get the user to choose an image URL.
TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
textPrompter.setText(bundle.getString("OpenURLDialog"));
textPrompter.setMessage(bundle.getString("En... |
2723983c-0fb8-4e66-b8b2-13d7f2846f10 | 4 | public void scoreCountCorrelate() {
double totalScore = 0;
int totalBusinessCnt = 0;
Map<Double, List<Integer>> businessScoreCountMap = new TreeMap<Double, List<Integer>>();
for (Business business:businessMap.values()) {
//System.out.println("hello");
totalBusinessCnt += 1;
double star = business.stars... |
f833b6db-2606-4703-9ce4-d94431d80d03 | 6 | public ListNode rotateRight(ListNode head, int n) {
// Start typing your Java solution below
// DO NOT write main() function
if (n == 0 || head == null || head.next == null)
return head;
ListNode firstNode = head;
ListNode secNode = head;
while (n > 0) {
n--;
firstNode = firstNode.next;
if (firs... |
2cc9cf4a-ff5b-42ff-9237-1aa7606a3da0 | 0 | public void setVersion(String value) {
this.version = value;
} |
13b54761-7526-4d60-9a35-129a2def8bdf | 1 | public boolean isAValidMethod(Request request) {
return isAURIMatch(request) && getRoutesMap(request).get(request.getURI()).containsKey(request.getHTTPMethod());
} |
5c061e83-8f49-41d3-b50e-02b750ca1d41 | 7 | public boolean hit(ArrayList<Bullet> bullets,int damage){
if( this.isAlive() ){
for(Bullet b:bullets){
//ӵŵʱɱ
if( b.isAlive() && b.getId()!=id ){
if(inside(b)){
//HP
if( hp>0 ){
hp = hp - damage;
}
if( hp<=0 ){
this.setAlive(false);
cx = this.x;
... |
a5083e75-1ccb-40d8-98dd-4ed49ba7b1cc | 6 | * @param arguments
* @return int
*/
public static int applyIntegerMethod(java.lang.reflect.Method code, Cons arguments) {
switch (arguments.length()) {
case 0:
throw ((StellaException)(StellaException.newStellaException("Can't call method code on 0 arguments.").fillInStackTrace()));
cas... |
5ff7223b-cca2-414a-a77e-c0fdccd43fb2 | 7 | @Override
public void paint(Graphics g) {
//if in fog draw the foggy images
if (tower.isInFog()) {
if (getTower() instanceof DefTower)
g.drawImage(defFog, x, y, null);
else if (getTower() instanceof DmgTower)
g.drawImage(dmgFog, x, y, null);
else if (getTower() instanceof SpdTower)
g.drawIm... |
146c95eb-9916-441a-8642-595f0118452a | 8 | public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
ByteBuffer buffer = ws.outQueue.peek();
WrappedByteChannel c = null;
if( buffer == null ) {
if( sockchannel instanceof WrappedByteChannel ) {
c = (WrappedByteChannel) sockchannel;
if( c.isNeedWrite() ) {
... |
b86b88cd-97a4-40e4-a3c4-1567f5a1e6e1 | 9 | public void paperRankInCluster(int iteratorNum, int cluster) {
String path = "";
if (cluster == k)
path = "";
else
path = "iteration" + iteratorNum + "//cluster" + cluster;
if (!FileUtil.isFileExist(path + "//" + FileUtil.FILE_PAPER)) {
HashMap<Integer, Double> rankMap = new HashMap<Integer, Double>();... |
bdfc5da0-6b3f-4717-b8a7-e7b525602baa | 6 | public String getDayZone(){
int hour = this.validTime.get(Calendar.HOUR_OF_DAY)+2;
String result;
if(hour >= 5 && hour < 12){
result = "morning";
} else if(hour >= 12 && hour < 18){
result = "afternoon";
} else if(hour >= 18 && hour < 22){
result = "evning";
} else {
result = "night";
}
... |
d065c114-bdc6-40be-9644-688d3ff9ea3a | 6 | public void adjustWeights(double[] vector, double koef)
{
// if ((Double.isInfinite(koef))||(Double.isNaN(koef))|| (koef > 1))
// System.out.println("WRONG");
double diffCoor = 0;
for (int i = 0; i < inN; i++){
double check = (vector[i] - weights[i]) * a * koef;
... |
8b4b2ff9-22f4-4cff-b368-5c666b0ef714 | 5 | private void addAllUniforms(String shaderText)
{
HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText);
final String UNIFORM_KEYWORD = "uniform";
int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD);
while(uniformStartLocation != -1)
{
if(!(uniformStartLocation != 0
... |
e2803afb-b053-4a25-ac61-9380159f0419 | 3 | protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
int c;
int[] lookup = BYTE_TO_CHAR; // getfield bytecode optimization
int remaining = in.remaining();
while (remaining-- > 0) {
if (out.remaining() < 1)
return CoderResul... |
0b6206a2-ca68-4e77-a67b-006ca6d1ae49 | 2 | @Override
public void registerDeleted(IDomainObject domainObject) {
assert domainObject.getId() != null : "id not null";
if (newObjects.remove(domainObject)) {
return;
}
dirtyObjects.remove(domainObject);
if (!removedObjects.contains(domainObject)) {
removedObjects.add(domainObject);
... |
12b3b30f-13b8-46fe-92e5-06873894ddcc | 6 | public static void STARTUP_FETCH_DEMO_CONTENT() {
{ Object OLD_$MODULE$_000 = Stella.$MODULE$.get();
Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/FETCH-CONTENT", Stella.$STARTUP_TIME_PHASE$ > 1));
... |
2a4adbd8-3620-4e30-8486-8c28d34c4d5a | 4 | @Override
protected void dispatchMessage(ICallbackEnum message, IEvent object) {
// Iterate methods
for(Binding binding : this.callbackBindings.get(message))
{
try
{
// Dispatch
if(object == null)
binding.invoke(this);
else
{
// Set session
object.setSession(this);
... |
2cee8a70-bc56-439b-b864-a7b72fa5a26c | 6 | private void doUpdateTrafficMask() {
if (trafficControllingSessions.isEmpty())
return;
for (;;) {
SocketSessionImpl session = trafficControllingSessions.poll();
if (session == null)
break;
SelectionKey key = session.getSelectionKey();
... |
8f1b5d27-698f-4537-a965-80b4500a7cd4 | 8 | @Override
public boolean controls(ChessCoord coord) {
if (!super.controls(coord)) {
return false;
}
// Here we are sure we are not at the coordinate ourselves
final int currentRank = this.getCoord().getRank();
final int currentFile = this.getCoord().getFile();
... |
7bf45a0f-64f7-438c-a95f-b43c73f8d92a | 2 | public void loadFavoriteServersList(List<Server> servers) {
favoritesMenu.removeAll();
if ( servers.size() > 0 ) {
for (final Server s : servers) {
JMenuItem item = new JMenuItem( s.get("title") );
item.addActionListener( new ActionListener() {
... |
74ca6762-21a0-4a38-9601-8d1bf37bafcd | 8 | protected Registration readName (Input input) {
int nameId = input.readInt(true);
if (nameIdToClass == null) nameIdToClass = new IntMap();
Class type = nameIdToClass.get(nameId);
if (type == null) {
// Only read the class name the first time encountered in object graph.
String className = input.readString... |
4ffd9608-08bd-42e8-8a78-cac035b90985 | 5 | private void ParseAttack(Node parentElement) {
Node child = parentElement.getFirstChild();
while (child != null) {
if (! handleGeneralProperty(child)) {
String nodeName = child.getNodeName();
// Can contain conditions, a print, and actions
if (nodeName == "print") {
attackMessage = child.getFirs... |
1b24d055-cf2e-4749-9713-bd175eba5e33 | 1 | @Override
public void setDefaultGraph(String graph) {
if(graph == null){
((SPARQLConnection) this.con).setDefaultGraphs(null);
}
LinkedList<String> graphs = new LinkedList<String>();
graphs.add(graph);
((SPARQLConnection) this.con).setDefaultGraphs(graphs);
} |
5c75f891-5be8-43b8-b8fb-1511c41af6eb | 6 | public char[] determineText(){
int sz = 0;
if(isUpper){
sz+= upperCase.length;
}
if(isLower){
sz+= lowerCase.length;
}
if(isNumbers) {
sz+= numbers.length;
}
char chars[] = new char[sz];
int offset = 0;
... |
fb1be570-33b1-40dc-bf8a-ad718ecc1cd8 | 2 | public void update() {
Window window = device.getFullScreenWindow();
if (window != null) {
BufferStrategy strategy = window.getBufferStrategy();
if (!strategy.contentsLost()) {
strategy.show();
}
}
// Sync the display on some systems.
... |
c1ed8be0-e42e-4ccb-b7b4-7169b5ff46ba | 5 | public void loadState(Session s) throws Exception {
for (int n = s.loadInt() ; n-- > 0 ;) {
final Target t = s.loadTarget() ;
final List <Action> l = new List <Action> () ;
s.loadObjects(l) ;
actions.put(t, l) ;
//
// Safety checks for can't-happen events-
if (! t.inWorld(... |
9901ba13-5be4-4fc9-8c9a-45269453d2b8 | 8 | protected Method findMethod(String name, Class<?> clazz, Class<?> returnType, Class<?>[] paramTypes) {
Method method = null;
try {
method = clazz.getMethod(name, paramTypes);
} catch (NoSuchMethodException e) {
throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, clazz... |
205ceaa3-8f64-49d8-a81b-595f24c61eda | 8 | private boolean jj_3R_38() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_23()) {
jj_scanpos = xsp;
if (jj_3_24()) {
jj_scanpos = xsp;
if (jj_3_25()) {
jj_scanpos = xsp;
if (jj_3_26()) {
jj_scanpos = xsp;
if (jj_3_27()) {
jj_scanpos = xsp;
if (jj_3_28()) {
jj_scanpos = x... |
65265834-4164-4dd5-8d93-efd89db3d959 | 0 | public int hashCode() {
int code = super.hashCode() ^ toRead.hashCode() ^ toWrite.hashCode()
^ direction.hashCode();
return code;
} |
38c4f2a6-47ba-492b-ad56-e7d8a7daf937 | 5 | public void bajaDeLicencia(int numero) {
EntityManager manager = verificarConexion();
if (numero <= 0) {
System.out.println("Se introdulo una licencia nula, no se puedo ejecutar la peticion");
return;
}
if (manager.find(LicenciaConductor.class, numero) != null) {
... |
9582e721-15c6-4964-a59e-e02380566651 | 5 | public void paint(Graphics2D g, Component component, int width, int height) {
MacWidgetsPainter<Component> painterToUse;
Window activeAncestor = null;
Window active = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getActiveWindow();
if (active != null) {
activeAncestor = SwingUtilities.getWindo... |
078b78ba-b1b7-4e13-b607-a02aea1e9b37 | 0 | public static PermissionMethodParser fromFile(String fileName) throws IOException {
PermissionMethodParser pmp = new PermissionMethodParser();
pmp.readFile(fileName);
return pmp;
} |
ec7c09ba-af74-4fd5-ba8f-4c409a1d0780 | 8 | public static String rowConverter(int row) {
switch (row) {
case 0:
return "A";
case 1:
return "B";
case 2:
return "C";
case 3:
return "D";
case 4:
return "E";
case 5:
return "F";
case 6:
return "G";
case 7:
return "H";
}
return "Failed";
} |
f11a58a1-17f9-4f06-bc97-edbd9522e455 | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
d0d60daf-c5e1-48ba-b623-3fa908cf7d17 | 3 | public void save(){
List<TreeItem> items = getItems();
items.remove(0); //Remove the tree root ("Project")
for(TreeItem item : items){
DatabaseTreeItem dataItem = (DatabaseTreeItem) item;
if(dataItem.gameData != null){
File f... |
fa4977aa-f0db-4240-aaad-b5872fb1451d | 6 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bookingclass other = (Bookingclass) obj;
if (clas == null) {
if (other.clas != null)
return false;
} else if (!clas.equals(other.clas))
return f... |
75edabbb-f126-4074-be7c-7f2108e962d4 | 6 | private void checkStaleHosts() {
long currTime = System.currentTimeMillis();
List<String> staleHostsToRemove = new ArrayList<String>();
for(TaskTrackerHB lastHB : lastHeartbeat.values()) {
if( currTime - lastHB.getSendTime() > 8*TaskTracker.JOB_TRACKER_HB_TIME) {
//This task tracker missed more than al... |
e5c2bb47-7d1a-4db3-a7b4-68b3706b797e | 1 | public String getURL()
{
String queryString = getQueryString();
return (queryString != null ? this.uri + "?" + queryString : this.uri);
} |
d4e53b94-bbf8-4cc3-b140-ab3056cccf35 | 4 | private static void panelProperties(Node node, StringBuilder code) {
GObject gObj = (GObject) node;
for (PanelProperty property : gObj.getPanelProperties()) {
String javaCode = property.getJavaCode();
if (!javaCode.isEmpty()) {
code.append(" ").append(javaC... |
1bd9ff94-1ccf-4536-ac0e-e7b7a69473c0 | 8 | public void deserializeFromStream(DataInputStream index) throws IOException {
int magic = index.readShort();
if (magic != MAGIC) {
throw new IOException("invalid magic at " + getPos());
}
nodeWeight = index.readInt();
int nodes = index.readShort();
if (nodes <... |
2afc8901-e98f-4cf3-9b8d-8185a970f15d | 2 | public String join(String separator) throws JSONException {
int len = length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayList.g... |
748fae95-ea1b-4e28-a613-850eb91d615f | 5 | public static void saveImage(BufferedImage img, ImageViewer imViewer, ImageMapper imMapper, String path, int mode, boolean rle)
throws CantSaveException
{
String fn = generateCleanFileName(path);
StringBuffer output = new StringBuffer();
//print data on the buffer
printData(out... |
6098b06b-8b2e-40e4-a769-fdfddbb5f158 | 1 | @Override
public int valueCount() {
return value == null? 0:value.length;
} |
e22f719e-cc12-491b-a0e5-f9b584af7937 | 9 | public boolean step(){
// NETWORK: transmit any current data in the network, then signal the source UAV and queuing ground station if it finished
PointCloud finishedCloud = network.step(currentTime);
if(finishedCloud != null){
//System.out.println("UAV #" + finishedCloud.getSrc().get... |
ca84c71c-174a-4fbd-afbb-123cdf4a50f3 | 2 | void invalidAction(JSONObject action){
try {
JSONObject errorMessage
= new JSONObject().put("error", "Invalid action: " + action.get("type"));
sendMessage(errorMessage);
} catch (JSONException f){}
catch (IOException g){}
} |
86ce3129-a63f-43ec-84c0-66d9d2210bd2 | 4 | public boolean canMove(int oldX, int oldY, int newX, int newY, boolean isNewSpotEmpty) {
int deltaX;
int deltaY;
deltaX = Math.abs(newX-oldX);
deltaY = Math.abs(newY-oldY);
if (deltaX == 0 && deltaY != 0){
return true;
} else if (deltaX != 0 && deltaY == 0) {
return true;
}
return false;... |
53f460e0-8892-4f42-a074-4980c3d60972 | 1 | public ArrayList<String> listFilesFromSourceNotInTargets() throws IOException{
ArrayList<String> strings = new ArrayList<String>();
for(int i=0;i<targetDirs.size();i++){
strings.add(listFilesFromSourceNotInTarget(i));
}
return strings;
} |
be806e8e-2622-4669-809b-cf0dca350a66 | 9 | public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
switch (cmd) {
case "EnterButton":
// first the driver presses the enter button, this creates a ticket
// need to get the next available ticket number from the garage
int ticketNumber;
try {
tick... |
9fd606a1-a616-4417-980f-d5efea4f2554 | 2 | public void updatePathField(Path text, boolean colorReset) {
String replace = text == null ? "" : text.toString();
this.path.setText(replace);
this.path.setToolTipText(replace);
if (colorReset) {
this.path.setForeground(Color.BLACK);
}
} |
2770389b-762d-44d2-a827-f9a8c45ec44f | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( -1 );
}
else if( obj instanceof GenKbGelExpansionBuff ) {
GenKbGelExpansionBuff rhs = (GenKbGelExpansionBuff)obj;
int retval = super.compareTo( rhs );
if( retval != 0 ) {
return( retval );
}
{
int cmp = getRequiredMacroName... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.