method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
46495610-daf8-4f9e-9fe9-2552d21247ea | 6 | private void setCurrentImage(){
switch (direction){
case 0: currentImage = image0;
break;
case 1: currentImage = image1;
break;
case 2: currentImage = image2;
break;
case 3: currentImage = image3;
break;
case 4: currentImage = image4;
break;
case 5: currentImage = image5;
break;
}
} |
b154693b-eb32-4e9b-9b18-47fe0114f5bc | 7 | @Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg();
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setFile(HTML);
StringBuffer sb = new StringBuffer(20);
... |
f7d1765d-dce2-48a6-89b8-6fda164788ee | 5 | @Override
public void run() {
System.out.println("Starting game");
running = true;
sendEvent(new GameStartEvent(this));
beginGameCall();
while(running) {
if(actionQueue.size() == 0 && running) {
synchronized(this) {
try { wait(); } catch (InterruptedException e) {}
}
} else if(running) {... |
c7e37eed-661d-45e0-b087-7c2e63f76559 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... |
42da4f05-514e-4fab-a39f-885702afd631 | 0 | public static void main(String[] args) throws IOException {
String fileName = "wap.txt";
Storage hashMapStorage = new HashMapStorage();
System.out.println("HashMap");
testStorage(hashMapStorage, fileName);
Storage treeMapStorage = new TreeMapStorage();
System.out.prin... |
6e13891b-ad49-4849-9f9b-ad708262898d | 9 | public void fingerAngle(final double angle) {
Platform.runLater(new Runnable() {
@Override
public void run() {
switch (state) {
case SUPER_FREE:
break;
case FREE:
handToFinger();
... |
c264e891-cb8f-4e32-b11a-8de9114b8018 | 7 | @Override
public Block.ExitStatus evaluate(IdentifierMap values)
{
Value evalIter = iterable.evaluate(values);
if (!(evalIter instanceof ListValue)) // this will probably be changed
throw new InvalidArgumentException(evalIter + " does not evaluate to a list value"); // is this a good exception?
ListValue as... |
dfb3fed2-6b2b-49c3-9401-f9c4c85e9ef9 | 3 | protected void paintComponent(Graphics g) {
super.paintComponent(g);
this.setBackground(new Color(255, 255, 100));
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth(... |
fe9d7040-9dae-482a-8f5d-4724903ee177 | 5 | @Override
public void mouseDragged(MouseEvent e)
{
mX = e.getX();
mY = e.getY();
if(canPath)
{
if(found) //After all possible movement paths have been found, it can start finding walk path
{
//sets added to false if current tile ch... |
1e83c127-fdf4-4ff7-803b-89ccb0b85676 | 6 | void avoidHills() {
if (moveManager.joinedCircuit()) return;
if (app.landscape == null) return;
Vector3d p_ = p.plus(v);
float h = p.z - app.landscape.getHeight(p.x, p.y);
float h_ = p.z - app.landscape.getHeight(p_.x, p_.y);
float dh = h_ - h;
if (h < 0) retur... |
e9ad17f5-72a1-4a06-ba60-61b885354ad7 | 4 | public Integer pick_card( List<Card> hand, Suit trump, Suit round ) {
Integer index;
if ( round != null ) {
List<Card> options = is_suit(hand, round);
if ( !options.isEmpty() ) {
index = randy_.nextInt( options.size() );
return hand.indexOf( option... |
f08a4525-f9c5-47e2-ade6-893dfb41a3aa | 4 | public User login(String userName, String password, String company)
throws AppSvcException {
Calendar cal = Calendar.getInstance();
cal.set(1966, 9, 2);
//TODO: Actual call to service. For the purpose of the demo creating a dummy User object
User user = null;
if ("guest".equalsIgnoreCase(use... |
40cf5717-b0e8-49a5-bd43-81d0357bf4a2 | 1 | public void closeConnections() {
try {
connection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
573487bf-e68a-4398-8c0f-33a4c5d1813a | 8 | public static HashMap<String, Integer> getPropagationTime(String fileLocation) throws FileNotFoundException{
HashMap<String, Integer> time = new HashMap<String, Integer>();
File file = new File(fileLocation);
Scanner scan = new Scanner(file); //<3 scanner 4ever
String line; //String to store each line as it's r... |
945bec51-6f75-4c0c-a3b0-84a4c3eab872 | 7 | public static String decrypt(String input, String key){
int inputLength = input.length();
char[] out = new char[inputLength];
int code = key.hashCode();
Character[] mapping = antiRandomizeArray(getMasterMapping(), code);
for(int i = 0; i < inputLength; i++){
char x = input.charAt(i);
if(x < 32 && x != 9... |
51885134-d731-4970-9436-2299f93669d4 | 1 | private String leerParametros(int tamano, BufferedReader entrada) throws IOException {
String parametros = "";
for(int indiceCaracter = 0; indiceCaracter < tamano; indiceCaracter++){
parametros = parametros + (char)entrada.read();
}
return parametros;
} |
f82eb76f-2547-4fc4-999d-41a6cd931acc | 1 | public void setWindowAnimation(Animation animation) {
if (animation == null) {
this.window_Animation = UIAnimationInits.WINDOW.getAnimation();
} else {
this.window_Animation = animation;
}
somethingChanged();
} |
1dc953d4-6e7c-409c-a073-042c7329fe36 | 5 | public static String getExecDirectoryPath()
{
String name = SystemUtils.class.getName().replace('.', '/');
name = SystemUtils.class.getResource("/" + name + ".class").toString();
if (name.contains(".jar"))
{
name = name.substring(0, name.indexOf(".jar"));
name... |
359a28ca-2e15-4543-8d10-edc8bc5c2079 | 9 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
liceu.Secretar s = new liceu.Secretar(numeClasa.getText());
try {
s.addClasa();
} catch (IOException ex) {
... |
6c8322a0-d516-4688-872e-60b10d477b72 | 0 | public void automataTransitionChange(AutomataTransitionEvent event) {
transitionChange(event);
} |
b50ea1f8-6c76-4f31-bba4-cbb55ffefd54 | 6 | @Override
public void collectLoot(Player player) {
int index = new Random().nextInt(14);
if (index == 14 || index == 13) {
player.addPlayerLevel();
getTextDisplay()
.displayText(
"As You Drink The Potion You Suddenly Understand How To Best Your Foes And You Feel Stron... |
f29f6c26-f28d-4552-b19c-1dbf9274981b | 8 | private void field_tipo_comprobanteFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_tipo_comprobanteFocusLost
boolean es_componente=false;
//voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos
if (evt.getOppositeComponent()!=fecha_f... |
9a20f2da-874a-4b27-be4a-7268d13ca209 | 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... |
871c41a7-a24e-4f8f-85ca-78c0a7be3b27 | 9 | public void desplegarRespuestas(Tema maestro) {
try {
if (con.isClosed()) {
con = bd.conexion();
}
Collection<Tema> temas = this.listarTemas();
Iterator it = temas.iterator();
while (it.hasNext()) {
Tema tt = (Tema) it.n... |
cd36bc59-ebbc-4953-a6ec-cb5e85eba462 | 5 | private boolean checkProperty(Properties properties) {
if (properties != null
&& properties.get(Setting.DataInPort) != null
&& properties.get(Setting.MalayansIP) != null
&& properties.get(Setting.ModuleDescription) != null
&& properties.get(Setting.ModuleID) != null) {
return true;
}
return fa... |
5f79bf5f-10f3-4039-b950-d07bdadcbf1e | 6 | int distToPiece(Space[] set, int n, Piece p){
int d = 0;
for(int i=n-1;i>=0;i--){
if(set[i].getPiece()==p){
d=n-i;
break;
}
}
for(int i=n+1;i<set.length;i++){
if(set[i].getPiece()==p){
if(d==0 || i-n<d)
d = i-n;
break;
}
}
return d;
} |
a43bba48-bca2-45ba-a6da-892030dd8d8d | 9 | static public String getTextForState(final DataState dataState) {
String text;
if(dataState == DataState.NO_DATA) {
text = "keine Daten";
}
else if(dataState == DataState.NO_SOURCE) {
text = "keine Daten (keine Quelle)";
}
else if(dataState == DataState.NO_RIGHTS) {
text = "keine Daten (keine Recht... |
5150fc20-667e-4ae1-94b4-195a7c9d62f2 | 6 | public void paintComponent(Graphics g) {
int n = graph.getVertexCount();
for(Vertex u : graph.getVertices()) {
int ux = BORDER + u.getColumn() * VERTEX_DIST;
int uy = BORDER + u.getRow() * VERTEX_DIST;
for(Vertex v : graph.getNeighbors(u)) {
int vx = BORDER + v.getColumn() * VERTEX_DIST;
int vy = B... |
380435ce-8fb6-4cc0-a50b-497bdd601566 | 5 | public void selectAll(int x0, int y0, int x1, int y1) {
x0 += xScroll;
y0 += yScroll;
x1 += xScroll;
y1 += yScroll;
if (x0 > x1) {
int tmp = x0;
x0 = x1;
x1 = tmp;
}
if (y0 > y1) {
int tmp = y0;
y0 = y1;
y1 = tmp;
}
int r = 8;
player.selected.clear();
for (Unit u : game.lev... |
ad3604c5-bdce-4452-a8b4-ab08fb994f92 | 3 | public JSONObject accumulate(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key,
value instanceof JSONArray ? new JSONArray().put(value)
: value);
... |
2d52c164-c22a-4f0c-b4eb-eda495ece8a2 | 6 | private boolean isBranch(String string)
{
if(string.equals("breq") || string.equals("brneq") || string.equals("brlt") || string.equals("brgt") || string.equals("brgeq") || string.equals("brleq"))
return true;
else
return false;
} |
cbbbb81d-6436-465a-989d-eac96f9ee9dd | 7 | private void cleanEntities() {
for (GameEntity ent : entities) {
if (ent instanceof Mine || ent instanceof PlasmaBall || ent instanceof PowerBar || ent instanceof Missile) {
if (ent.isDestroyed()) {
Log.e(TAG, "I'm about to CLEAN: " + ent);
removeEntity(ent);
if (ent instanceof Observer)
r... |
72b89a20-7461-452c-a6b3-7034d3049bcc | 8 | public void mouseReleased( MouseEvent e ) {
mousePos=e.getPoint();
LBNode mouseOverN = (LBNode) tgPanel.getMouseOverN();
if (mouseOverN!=null && dragAddNode!=null && mouseOverN!=dragAddNode) {
Edge ed=tgPanel.findEdge(dragAddNode,mouseOverN);
if (ed==... |
bad4b14e-38b8-43c8-859e-f7e75137cf75 | 0 | public boolean isDirty() {
return dirty;
} |
21659185-d34e-4f65-9a9c-9edf659d671b | 9 | public boolean containsIP(String message, Player p)
{
if(message.startsWith("http://") || message.startsWith("www") || p.hasPermission("pb.bypass.advertise") || p.hasPermission("pb.*"))
{
return false;
}
Pattern pattern = Pattern.compile("\\d{1,4}\\D{1,3}\\d{1,4}\\D{1,3}\\d{1,4}\\D{1,3}\\d{1,4}");
Pattern... |
e81e6d0c-b381-4e6f-bdbd-77841afed1a2 | 8 | public static ArrayList<Object> comparisonTest(int modelXindices[], double sumOfSquares1, int nParameters1, int nData1, double sumOfSquares2, int nParameters2, int nData2, double significance){
ArrayList<Object> al = new ArrayList<Object>();
double fRatio = Double.NaN;
double fProb = Double.Na... |
53639e4f-efa8-433b-afcf-d42b76f8ca5a | 1 | private static double time(String alg, Comparable[] a)
{
double t = -1.0;
String c = (alg.split("[.]"))[0];
String m = (alg.split("[.]"))[1];
Stopwatch timer;
try
{
timer = new Stopwatch();
Class.forName(c).getMethod(m, Comparable[].class)
.invoke(null, (Object) a);
t = timer.elapsedTime();... |
26d22161-fec5-4a30-beb4-887b1f2197c3 | 0 | @Override
public void push(T task) throws IllegalArgumentException, InterruptedException {
updateLength(1);
taskAcceptor.push(task);
} |
fa87bc90-3739-43dd-b0d3-3ee5e225be57 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ContactImpl other = (ContactImpl) obj;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
... |
16a9545e-d4f2-4b2d-a4be-9bf236f29d9f | 7 | public Profile findProfile(Main plugin, PendingConnection connection, ListenerInfo info) {
Server serverMatch;
synchronized (this) {
if (serverCache.containsKey(info)) {
serverMatch = serverCache.get(info);
} else {
serverMatch = null;
... |
bd9b2acb-ebe2-4ae8-95f6-a224442aba37 | 9 | private void setCharacter(int character)
{
if ((character == 10 && state.getCharacter() == 12) || (state.getCharacter() == 12 && character == 10))
{
System.out.println("Nan");
setText("Mario refuses to face Nan.\nPlease choose another character.");
}
else if ((character == 1 && state.getCharacter() == 12... |
10fa0def-d5ac-46f9-a053-e81c73ce44f5 | 7 | static final boolean method1474(byte byte0) {
if (byte0 != 59) {
return true;
}
try {
if (Player.anInt3791 == 2) {
if (Class92.aClass142_Sub30_1586 == null) {
Class92.aClass142_Sub30_1586 = Class142_Sub30.method1975(Class47.aClass73_806... |
a8bd19ce-55ca-4497-8760-9282aea98ed9 | 1 | @Override
public void windowOpened(WindowEvent e) {
if (e.getID() == WindowEvent.WINDOW_OPENED) {
this.setLocationRelativeTo(null);
this.setVisible(true);
}
} |
5e0264b9-45d7-4ed0-897b-3b328a04b640 | 3 | public void visitJumpInsn(final int opcode, final Label label) {
minSize += 3;
if (opcode == GOTO || opcode == JSR) {
maxSize += 5;
} else {
maxSize += 8;
}
if (mv != null) {
mv.visitJumpInsn(opcode, label);
}
} |
6a6f606c-620b-4452-bc4a-6d175c5a892e | 7 | protected static Ptg calcTrim( Ptg[] operands )
{
Object o = operands[0].getValue();
String res;
if( o instanceof Double )
{
res = ExcelTools.getNumberAsString( (Double) o );
}
else
{
res = String.valueOf( o );
}
if( (res == null) || res.equals( new PtgErr( PtgErr.ERROR_NA ).toString() ) )
{
... |
ce49aa29-4273-49bd-9087-4b1fffef76bd | 6 | public int compareRecipes(IRecipe par1IRecipe, IRecipe par2IRecipe)
{
return par1IRecipe instanceof ShapelessRecipes && par2IRecipe instanceof ShapedRecipes ? 1 : (par2IRecipe instanceof ShapelessRecipes && par1IRecipe instanceof ShapedRecipes ? -1 : (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize(... |
42829f92-31b0-4c94-a863-aeca036535d6 | 9 | synchronized public void changeLocBypass(int newLocX, int newLocY)
{
int oldLocX = intLocX;
int oldLocY = intLocY;
engGame.removeDuskObject(this);
intLocX = newLocX;
intLocY = newLocY;
try
{
if (isPlayer())
{
updateMap();
if (engGame.overMerchant(oldLocX,oldLocY) != null)
offMerchant()... |
39db8914-c709-405d-92af-f78df0a6d8a9 | 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... |
b574f159-3ff7-4ed8-bf05-71bcc25ac522 | 8 | public static void binarySearch(int[] array) {
if (array.length <= 2)
System.out.println("No such value in the array.");
int left = 0;
int right = array.length - 1;
while (right > left + 1) {
int middle = (left + right) / 2;
if (middle == 0 || middle == array.length - 1) {
System.out.println("No su... |
18a2ad11-93b8-4432-8dc5-89cdadd57f8d | 3 | @EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
if (parentarena.getplayers().contains(player)) {
if (parentarena.getboss() == player) {
parentarena.bossDeath();
} else if (parentarena.isLiving(player)) {
parentarena.playerDeath(player);
}
}
... |
f2829a2c-1b90-4a7e-9676-976dafd1a5fe | 1 | public void store(OutputStream out) throws IOException {
PrintWriter writer = new PrintWriter(out);
for (Iterator i = entrySet().iterator(); i.hasNext();) {
Map.Entry e = (Map.Entry) i.next();
writer.println(e.getKey() + "=" + e.getValue());
}
writer.flush();
} |
446e2c81-47c8-49de-85b0-b5ba1d69fcb2 | 6 | @Override
public void stateChanged(ChangeEvent event) {
if(event.getSource() == carbohydratePercentageSlider) {
try {
carbohydratePercentageTextField.setText(String.valueOf(carbohydratePercentageSlider.getValue()));
} catch(NumberFormatException nfe) {}
} else if(event.getSource() == proteinPercentageSli... |
aa291783-91ab-44b5-b3ba-baaeda6304de | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
44842c84-626c-45a9-8f24-6d7e32059390 | 8 | private Dimension layoutSize(Container target, boolean preferred)
{
synchronized (target.getTreeLock())
{
// Each row must fit with the width allocated to the containter.
// When the container width = 0, the preferred width of the container
// has not yet been calculated so lets ask for the maximum.
int ... |
d4bb6def-1b0c-45ac-ad97-460b11e79993 | 6 | private LinkedList<CActor> generateList(){
LinkedList<CActor> list = new LinkedList<CActor>();
//finds lowest value in array and subtracts that from each integer in array
while(true){
Iterator<CActor> actors = CActor.getActors().listIterator(0);
CActor actor = actors.next();
int subtract =... |
4bbff8b3-e18c-4d3c-a8ea-620703ec5242 | 3 | private boolean ContainsProduct(List<Product> p_list, String p_productName)
{
for(Product product : p_list)
{
if(product != null && product.GetTypeProduct().GetName().equals(p_productName))
{
return true;
}
}
return false;
} |
64870211-d18d-4720-b0eb-00b93a2f3ae1 | 5 | public static void drawVerticalAlphaLine(int x, int y, int length, int color, int alpha) {
if (x < startX || x >= endX) {
return;
}
if (y < startY) {
length -= startY - y;
y = startY;
}
if (y + length > endY) {
length = endY - y;
}
int alphaValue = 256 - alpha;
int red = (color >> 16 & 0xff)... |
ca64696e-8720-41c9-b1d3-8c6c6f788eaa | 5 | @Override
public void mouseDragged(MouseEvent me) {
for (int i=0;i<a.getDataModel().getCurveList2().size();i++) {
ArrayList<Contour> contours=a.getDataModel().getCurveList2().get(i).getContourList();
for (int j=0;j<contours.size();j++) {
if (contours.get(j).getSelected()) {
contours.get(j).setPoint(ne... |
7be3cd68-e02a-4b01-905b-446a53d84084 | 1 | @EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
if (The5zigMod.getApi().isUsingMod(e.getPlayer())) plugin.users.remove(The5zigMod.getApi().getUser(e.getPlayer()));
} |
42069dcd-6161-43fa-9134-c0800f919b6e | 7 | public IMessage decrypter(IMessage crypte, String key) {
/*
* Lecture de la clef, puis dcodage des caractres un par un par
* des oprations elementaires
*/
String keyAdaptee=this.adapter(key);
long d=new Date().getTime();
int k;
char[] c=new char[crypte.taille()];
for(int i=0;i<crypte.taille();i++) ... |
e85e04d8-41ed-4f01-bf69-3422924ce9e7 | 1 | public void setLocation(Location newLocation)
{
if(location != null) {
field.clear(location);
}
location = newLocation;
field.place(this, newLocation);
} |
7b0d9afb-2fa4-409d-a5b0-935b25a12b2c | 7 | @Override
public void paint(Graphics g){
iniciarVAr(this);
BufferedImage image = new BufferedImage(maxX,maxY, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) image.createGraphics();
paintCuadricula(g2);
asignarV(g2);
switch (polygonPaint) {
case... |
0a71182f-d77a-4f98-9e06-70dba6151cd9 | 3 | private static Move ForwardLeftForWhite(int r, int c, Board board){
Move forwardLeft = null;
if( r<Board.rows-1 && c>=1 &&
board.cell[r+1][c-1] == CellEntry.empty
)
{
forwardLeft = new Move(r,c, r+1, c-1);
}
return forwardLeft;
} |
dc5b479c-9473-49ce-a680-e42532c7ed43 | 4 | private Solution depthFirstSearch(Node selectedNode, Puzzle puzzle,
int currentCostBound) {
if (puzzle.getGoalTest().isGoalState(selectedNode.getState()))
return new Solution(selectedNode, nodeExpanded);
nodeExpanded++;
LinkedList<Node> expansion = selectedNode.expandNode();
for (Node n : expansion) {
... |
c5ee7675-8a5c-4944-b18e-79ae242398de | 9 | public void drawRect(short colix, int x, int y, int z, int zSlab, int rWidth, int rHeight) {
// labels (and rubberband, not implemented)
if (isClippedZ(zSlab))
return;
int w = rWidth - 1;
int h = rHeight - 1;
int xRight = x + w;
int yBottom = y + h;
setColix(colix);
if (y >= 0 && y < height)
line3... |
e57ed4e8-bd63-4a01-a7b4-1faaa57ddc58 | 9 | static final Class145 method3431(GLToolkit gltoolkit, int i, Class210[] class210s) {
anInt8099++;
for (int i_12_ = i; (class210s.length ^ 0xffffffff) < (i_12_ ^ 0xffffffff); i_12_++) {
if (class210s[i_12_] == null || class210s[i_12_].aLong2500 <= 0L) {
return null;
}
}
long l = OpenGL.glCreateProgramO... |
10445ff9-7eb1-488b-b97b-9f419242c6f1 | 3 | private void setPermutationQuest(OrderQuest quest,
ArrayList<String> answerList, ArrayList<String> indexList) {
int index=1;
ArrayList<String> list = new ArrayList();
for(int j=0;j<answerList.size();j++)
{
for(int i=0;i<answerList.size();i++)
{
if(Integer.parseInt(indexList.get(i))==index)
... |
b0b1b151-04a7-496f-9c60-cb08fe464a19 | 5 | protected boolean validateGridlet(SSGridlet sgl) {
int reqPE = sgl.getNumPE();
if(reqPE > super.totalPE_){
String userName = GridSim.getEntityName(sgl.getSenderID());
logger.info("Gridlet #" + sgl.getID() + " from " +
userName + " user requires " + sgl.getNumPE() + " PEs. " ... |
da5c6394-5cd0-4dce-897f-7a799b6bde21 | 2 | @Override
public void writeTo(WordWriter out)
throws IOException {
for(int i=0; i<repeatCount; i++) {
for(UnresolvedData data : dataList) {
data.writeTo(out);
}
}
} |
6424dbec-8936-4d0a-8a7a-697aebe1c0fd | 4 | public void update(){
if ( position.x + velocity.x - r < 0 || position.x + velocity.x + 2 * lengthToEdge(0) >= Main.SIZE){
velocity.x *= -1;
}
if (position.y + velocity.y - r < 0 || position.y + velocity.y + 2 * lengthToEdge(3 * Math.PI / 2) >= Main.SIZE){
velocity.y *= -... |
29ff3d90-ed65-4ca0-8bd3-6b461fc60dd2 | 5 | protected void rmBus (Object busname)
{
USB bus = (USB) busses.get (busname);
if (bus != null) {
if (trace)
System.err.println ("rmBus " + bus);
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
... |
90149b50-ac2c-4041-bb3c-f00b9940d7c1 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair other = (Pair) obj;
if (a == null) {
if (other.a != null)
return false;
} else if (!a.equals(other.a))
return false;
if (b == ... |
95748040-68c5-451a-b00d-7f2d2c4b0a35 | 4 | public void tick() {
if (running) {
List<Integer> delete = new ArrayList<Integer>();
for (int i = 0; i < particles.size(); i++) {
Particle3D p = particles.get(i);
if (p.getY() < 0) {
delete.add(i);
}
p.t... |
ee7b6410-24be-4811-97a4-39ec8dbed986 | 5 | public static Version ofJar(Class cls)
{
String url = null;
// Construct the path to the class file and get its URL.
// E.g. /org/apache/wicket/Component.class
String path = "/" + cls.getName().replaceAll("\\.", "/") + ".class";
URL classRsrc = cls.getResource(path);... |
1bb52463-1332-4a62-8ea7-11c58927a837 | 3 | @Override
public Vector getColumnVector(int column) throws OutOfBoundsException {
if (column > getColumnsNumber() || column < 1) {
throw new OutOfBoundsException();
}
int length = _values.length;
double[] vals = new double[length];
for (int i = 0; i < length; i++) {
vals[i] = _values[i][column-1];
... |
2b5dea4d-462f-4ed1-a806-6ebe8769e8b1 | 0 | public void colorGrey() {
myColor = GREY;
} |
31b512a5-18e7-4bb4-b7f5-89abbc58445a | 8 | public ListIterator listIterator(final int startIndex) {
if (startIndex < 0 || startIndex > instructionCount)
throw new IllegalArgumentException();
return new ListIterator() {
Instruction instr = get0(startIndex);
Instruction toRemove = null;
int index = startIndex;
public boolean hasNext() {... |
de35a6e9-f173-495d-9c39-a6553dced489 | 3 | protected void remove() {
// ѡеҪɾ
int row = this.table.getSelectedRow();
if (row < 0)
return;
// Ҫɾѧѧ
final String no = (String) tableModel.getValueAt(row, 0);
// ݿstudentsɾѧ
database.delStudent(no);
Iterator<Student> it = students.iterator();
while (it.hasNext())
if (it.next().no.equals(no)) ... |
a9b3a9d2-8178-449a-8aec-553fed933e28 | 3 | protected void processGISResourceList(Sim_event ev)
{
if (ev == null || ev.get_data() == null) {
return;
}
Integer id = (Integer) ev.get_data();
int tag = AbstractGIS.GIS_INQUIRY_RESOURCE_RESULT;
boolean result = sendListToSender(id.intValue(), tag, resList_);
... |
579918a2-da69-4ffd-be3b-f327dbc66b1d | 4 | @Override
public void onUpdate(World apples) {
if (collided(apples))
{
// apples.ground.FillCircleW(X, Y, radius, World.STONE);
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
for (Player p:apples.playerList)
{
if (apples.pointDis(X, ... |
f8317021-5fdf-402b-8f15-58b16bfc1c81 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Permissie other = (Permissie) obj;
if (id != other.id)
return false;
return true;
} |
faae0b43-d972-4922-8f9b-1bb82d1e3747 | 2 | public void act(){
if (selected){
selected = false;
if (hoverCounter >= 50){
map.hm.setData (this);
int[] co = setCo();
map.addObject (map.hm, co[0], co[1]);
}
}
updateImg();
this.setImage (bg);
... |
ceff20c7-bbc6-469d-b3b3-9fe5ebfdd51a | 8 | private static void determineMacOSVersion() throws IOException {
File f = new File( "/System/Library/CoreServices/SystemVersion.plist" );
MAC_OS_VERSION = null;
try {
SAXBuilder parser = new SAXBuilder(false);
//this hack is intended to prevent SAXBuilder from connecting to the 'net
parser.setEntityReso... |
0593c236-19ab-4793-8301-dd750afd0876 | 0 | @Override
protected EntityManager getEntityManager() {
return em;
} |
31044e64-2610-4f07-b182-698a13d3e296 | 6 | void processMap(OMMMap symbolList)
{
if (_itemManager == null)
_itemManager = new SymbolListItemManager(_appContext, _serviceName, _msgModelType,
symbolList.getTotalCountHint());
for (Iterator<?> iter = symbolList.iterator(); iter.hasNext();)
{
OMM... |
7e44ed71-4f17-42c0-84ad-9ecdd7464f4d | 0 | @Override
public String getMessageTextAsHTML() {
String msg = "";
msg += "<font color="+Constants.NOTIFICATION_COLOR+">";
msg += name + " " + settings.getLanguage().getLabel("text_newparticipant");
msg += "</font>";
return msg;
} |
d5ab718c-3c4d-4d7a-b856-08d9d48e583b | 4 | public boolean readFolder(File file) {
final List<File> listFiles = listFilesForFolder(file);
if(listFiles == null)
return false;
for (File f : listFiles) {
try {
String md5 = getMD5Checksum(f.getAbsolutePath());
if (!checkFileWithDB(f.getAbsolutePath(), md5)) {
final FilesParsed filesParsed =... |
f7c1020a-6f72-4736-9cc3-c4a2406c062e | 9 | private void parseSql() {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(scriptFile));
StringBuffer buffy = new StringBuffer();
String line = br.readLine();
while (line != null) {
if(line.startsWith("--")) {
// ignore comments
line = br.readLine();
continue;
... |
dace78ec-d168-4b61-b953-c568dcc358e9 | 4 | private String convert(int num){
if (num == 0){
return "";
}
int bit_of_num = 0;
int tmp = Math.abs(num);
while( tmp != 0){
tmp >>= 1;
++bit_of_num;
}
StringBuffer res;
if (num > 0) {
res = new StringBuffer(... |
fabf49da-1bd6-4470-a4d9-75b4eb66d92e | 2 | public void run() {
isCheckingForTimeouts = true;
while(isCheckingForTimeouts) {
//tell the server to check for clients that have timed out
long oldestCommunication = server.checkClientTimeouts(timeout);
//sleep until the next client is expected to time out
long now = System.currentTimeMillis();
... |
f054542d-37e9-43e0-9f23-afdf9c8c7792 | 2 | public Object open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
} |
f07acd52-8df0-4781-a8f3-4786e137d441 | 8 | @Override
public Map<String, String> getSearchCritieras() {
Map<String, String> critieras = new HashMap<>();
if(!StringUtil.isEmpty(componentId.getText())) {
critieras.put("componentId", componentId.getText());
}
if(!StringUtil.isEmpty(date.getText())) {
criti... |
c0ea3fd4-747a-4231-816a-71e4c8da7605 | 4 | public Property<String> getFirstProperty(String name){
for(Property<String> property : properties){
if((property != null) && (property.getName() != null) && property.getName().equals(name)){
return property;
}
}
return null;
} |
aa3003ba-f790-4015-b3c6-9c2de62b240c | 8 | public void DirDoesNotEqualLastDir(int LastDir) {
if(dir == 0) {
sprite = ForwardAnims.idle();
}else if(dir == 1) {
if(LastDir == 0) {
LeftAnims = ForwardAnims;
RightAnims = ForwardAnims;
} else if(LastDir == 2) {
LeftAnims = ForwardAnims;
LeftAnims = BackwardAnims;
}
sprite = LeftAni... |
5b35397e-541d-4957-b638-9ec70be712c2 | 7 | @Override
public void printException(Throwable t) {
if(t == null) return; //If the Throwable is null, ignore it
int indent = 1;
//Print exceptions only if DebugMode is on or if the Throwable is an instance of a RuntimeException
if(this.isDebugModeEnabled() || (t instanceof RuntimeException)) {
this.excep... |
42fb7b52-b8ba-42b1-a169-e29b1db7188f | 0 | public void setGoTo(String []goTo) {
this.goTo=goTo[0];
} |
73815619-a1f6-4136-90e1-9fbacc9794e7 | 3 | public void reverse()
{
ArrayList<String> reverser = new ArrayList<String>();
for (String each : trip)
{
reverser.add(each);
}
for (int i = trip.size()-1; i >= 0; i--)
{
trip.remove(i);
}
for (int i = reverser.size()-1; i >= 0; i--)
{
trip.add(reverser.... |
e16e4e98-7876-4122-9258-4cd220b3523b | 9 | public static BigInteger primeRoot(BigInteger p) {
if (!p.isProbablePrime(100))
return null;
ArrayList<BigInteger> tried = new ArrayList<BigInteger>();
while (true) {
boolean found = false;
BigInteger g = null;
while (!found) {
g = new BigInteger(p.bitCount(), new java.util.Random());
if (tri... |
33417d74-fba1-4d69-8169-9237f82bf233 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Subject other = (Subject) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return ... |
d500ba79-bdf9-4402-a3b7-b26e31882882 | 7 | public void openCell(int x, int y) {
final Cell cell = cells[x][y];
// Force open cells
if (cell.getState() == Cell.State.OPEN) {
forceOpenCells(x, y);
}
// Dont open a flagged cell
if (cell.getType() == Cell.Type.FLAGGED ||
cell.getType() ==... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.