method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cca7ac81-ee80-41e6-ae1c-1655109bc11a | 3 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == leave) {
wdgmsg("leave");
return;
}
for (Member m : avs.keySet()) {
if (sender == avs.get(m)) {
wdgmsg("click", m.gobid, args[0]);
return;
}
}
super.wdgmsg(sender, msg, args);
} |
9db86f62-2211-4f1f-b2ef-46d71a7b5814 | 0 | public void setThreads(Integer threads) {
this.threads = threads;
} |
0405e440-58ee-4062-b781-dcb4fa8bb9eb | 5 | @Override
public void validate(FacesContext context, UIComponent component,
Object value) throws ValidatorException {
String password = value.toString();
UIInput uiInputConfirmPassword = (UIInput) component.getAttributes().get("pwd2");
String confirmPassword = uiInp... |
2b22a6b0-230c-4dcd-8413-d183b4029b5d | 2 | int value(Board b, Side s) {
if (b.piecesContiguous(s)) {
return 1;
} else if (b.piecesContiguous(s.opponent())) {
return -1;
} else {
return 0;
}
} |
abb0af40-b80d-4acb-b956-edc812cbc2bb | 5 | public boolean compBlock(Material block, Player play, String sAction, ArrayList<PaymentCache> aPayer) {
HashMap<String, ArrayList<Material>> hJobs = _jobsdata.getMatHash();
if(hJobs.isEmpty())
return false;
for(Map.Entry<String, ArrayList<Material>> e : hJobs.entrySet()) {
... |
f4acbf42-cd2e-40ec-850b-233fb52baf4e | 4 | public void reiniciar(){
if (comboBox_1.getSelectedItem() == "Universitario" || comboBox_1.getSelectedItem() == "<Selecciona>") {
comboBoxGrado.setSelectedItem("<Selecciona>");
comboBoxNivelAlcanzado.setSelectedItem("<Selecciona>");
comboBoxPostGrado.setSelectedItem("<Selecciona>");
comboBox_Certificacion... |
625990f7-3b18-4955-b403-738aca7472c8 | 9 | private void order(String order, String location,
List<ServiceRequest> requests) {
if (order != null) {
if (order.equals("popular")) {
Collections.sort(requests, new Comparator<ServiceRequest>() {
@Override
public int compare(ServiceRequest sr1, ServiceRequest sr2) {
if (sr1.getVotes() == s... |
46adfe9f-f48f-4beb-8a92-557666d5cdef | 4 | public void paint(Graphics g) {
int frameHeight = getSize().height;
int frameWidth = getSize().width;
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.clearRect(0, 0, frameWidth... |
fc4aeda7-4311-4372-bc10-863c78dab93b | 7 | void addAlternative(){
String new_name = (String)JOptionPane.showInputDialog(
this,
"Alternative name:",
"Add New Alternative",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"Alt(" + counter + ")");
... |
7162dafd-baac-4338-8c99-a47980002725 | 4 | public boolean doesDatabaseExist() {
try {
getConnection(true);
rs = getConn().getMetaData().getCatalogs();
while (rs.next()) {
String databaseName = rs.getString(1);
if(databaseName.equals(dbName)){
return true;
}
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
... |
4041ddde-9798-4345-86b1-dca600dc7e5f | 2 | public NextVoteManager(final NextVote nvPlugin) {
this.plugin = nvPlugin;
try {
plugin.getDatabase().find(VoteHistory.class).findRowCount();
} catch (PersistenceException ex) {
log.log(Level.INFO, "Installing database for " + plugin.getDescription().getName() + " due to f... |
87d72741-6257-42bb-8464-eadab0377acb | 2 | public synchronized static void renameBlob(String newName, String oldName) {
File file = new File(oldName);
if (file.isDirectory()) {
System.out.println("Blob is a directory");
renameBlobDir(oldName, newName);
}
if (file.isFile()) {
System.out.println("Blob is a file");
renameSingleBlob(oldName, ne... |
8c4e5b0d-7c9a-42f0-b8c5-e0d155e537e0 | 3 | @Override
public void body() {
loadResourcesIDs();
while (true)
{
printRuntimeMessage("Submitting next gridlets chunk...");
int submittedCount = submitGridletsChunk();
printRuntimeMessage(String.format("...%1$d gridlets submitted",
sub... |
62c01301-9ddd-4c8c-b19f-d36b7f238618 | 2 | public static MetroSubmodesOfTransportEnumeration fromValue(String v) {
for (MetroSubmodesOfTransportEnumeration c: MetroSubmodesOfTransportEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
7325e426-c65b-4998-9a38-50501fb1b0f2 | 1 | public AlbumFeature(File song)
throws MP3Exception {
super(song);
this.obf= new ObjectFactory();
this.album= this.obf.createAlbumType();
this.getHttp= GetHttpPage.getInstance();
try {
this.log= AlbumLogger.getInstance().getLog();
} catch (LogException e) {
throw new MP3Exception("LogException "... |
07772b9c-4909-40b8-8876-0c515898124b | 5 | public boolean postMortem(PostMortem pm) {
JSONzip that = (JSONzip) pm;
return this.namehuff.postMortem(that.namehuff)
&& this.namekeep.postMortem(that.namekeep)
&& this.stringkeep.postMortem(that.stringkeep)
&& this.substringhuff.postMortem(that.substring... |
afd591d0-0079-4aa7-9495-ac161cbd65bf | 9 | private boolean searchUpForPrevSubsetNode( Node node, K key, Object[] ret ) {
if( node.mLeft != null && mComp.compareMins( node.mKey, key ) >= 0 &&
mComp.compareMinToMax( key, node.mLeft.mMaxStop.mKey ) < 0 )
{
// Request downward searh on left subtree.
ret[0] = node... |
14d628ca-1bdf-4b0e-9d20-2a8d2fda5ac3 | 0 | public static int taxiCab(int color1, int color2) {
int dRed = Math.abs( ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16));
int dGreen = Math.abs( ((color1 & GREEN_MASK) >> 8) - ((color2 & GREEN_MASK) >> 8));
int dBlue = Math.abs( (color1 & BLUE_MASK) - (color2 & BLUE_MASK));
... |
008e1b3d-ecc9-43af-8fc9-cab5a32e1ea5 | 4 | public static byte menuprincipal(){
byte op=0;
do{
System.out.println("1 Abrir cuenta bancaria");
System.out.println("2. Consultar saldo cuenta bancaria");
System.out.println("3. Extraer dinero cuenta bancaria");
System.out.println("4. Ingresar dinero cuenta bancaria");
System.out.println("5. Salir");
... |
28e970d3-4142-4a3d-9163-0001485f9069 | 8 | private double parseMulOrDiv() throws Exception{
char op; //
double result; //
double partialResult; //ӱʽĽ
//ָ㵱ǰӱʽֵ
result=this.parseExponent();
//ǰǵĵһĸdz˳ȡģг˳
while((op=this.token.charAt(0))=='*'||op=='/'||op=='%'){
this.getToken();//ȡһ
//ָ㵱ǰӱʽֵ
partialResult=this.parseExponent();
switch(op... |
50bacd62-b1f0-4d9f-bb8b-b99f07afe0d7 | 0 | public void setAdresse(String adresse) {
this.adresse = adresse;
} |
ce7bb5f9-6239-406e-b4fa-95e91bc374e9 | 6 | static public String numberToString(Number n)
throws JSONException {
if (n == null) {
throw new JSONException("Null pointer");
}
testValidity(n);
// Shave off trailing zeros and decimal point, if possible.
String s = n.toString();
if (s.indexOf('.') > 0 ... |
dcf476be-2688-4d2c-80d9-514ac9165561 | 7 | public void mousePressed(MouseEvent e) {
JPanel panel = (JPanel)e.getSource();
Component component = panel.getComponentAt(e.getPoint());
if (component instanceof Field) {
Field field = (Field)component;
int x = field.getFieldX();
int y = field.getFieldY();
... |
e212d7d1-c3f3-460e-a129-67952bd37522 | 1 | public Object get(int index) throws JSONException {
Object object = opt(index);
if (object == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return object;
} |
f27a1485-5a59-4bcb-af89-cbc79b01b55b | 0 | public boolean isAlive()
{
return alive;
} |
3ea4108a-c59b-49b3-b8a7-c8f336847639 | 2 | public CodeRunResult run(CodeRunParams params) {
CodeRunResult result;
Class clazz = params.getCompilationResult().getCompiledClasses().get(TestClassCodeBuilder.TEST_CLASS);
try {
Object o = clazz.getConstructor().newInstance();
Method m = clazz.getDeclaredMethod("execute... |
eb0b042b-cfb3-4317-b332-b4eec725dbfb | 0 | public void setQuantity(Integer quantity) {
this.quantity = quantity;
} |
02487ef9-c00f-44b2-8fd1-435d875f5633 | 0 | public void setOtherTlvArray(Tlv[] otherTlvArray) {
OtherTlvArray = otherTlvArray;
} |
8465e41a-3391-419b-9291-57580e5f6cba | 6 | public synchronized double compute() {
if ((getChild1() != null) && (getChild2() != null)) {
double val1 = getChild1().compute();
double val2 = getChild2().compute();
if (getOperator().equals(ADD)) {
setValue(val1 + val2);
} else if (getOperator().equals(SUBTRACT)) {
setValue(val1 - val2);
}... |
92be7b65-7593-4731-8f78-7663017d4f87 | 6 | @Override
public void setPixel(int x, int y, int c)
{
if (x < 0 || x >= width)
return;
if (y < 0 || y >= height)
return;
if (format == 1)
{
c &= 0x1F;
c |= getPixelVal(x, y) & (~0x1F);
}
if (format == 6)
{
... |
58f2875e-c467-4945-b98b-40c043c23e61 | 7 | public static int jump_greedy(int[] A) {
// try greedy
if(A==null || A.length<=1) return 0;
int cnt = 0;
int start = 0;
int end = 0;
while(true) {
int curMaxEnd=end;
cnt++;
for(int i=start;i<=end;++i) {
if((A[i]+i)>curMa... |
c6e8df94-5f78-4b82-9b68-ca5547f01071 | 6 | public boolean isYourMove() throws InterruptedException {
boolean test = false;
if (test || m_test) {
System.out.println("ConnectFourAI :: isYourMove() BEGIN");
}
setYourTurn(true);
if (!(getGame().getPlayer1() instanceof Human ||
getGame().getPlayer2() instanceof Human)){
sendMov... |
233731db-ad0b-45b8-9f5f-9c3485ef87bd | 6 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
BufferedImage pokemonSpriteSheet = null;
try {
pokemonSpriteSheet = ImageIO.read(new File("Images/CondensedOverworldSprites.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}... |
2dc23bc3-3343-4d98-b133-090052c0ef4c | 8 | private int minDistance_dp(String word1, String word2) {
if (word1.equals(word2)) {
return 0;
}
int M = word1.length(), N = word2.length();
if (M == 0 || N == 0) {
return Math.abs(M - N);
}
// init P
int[][] P = new int[M + 1][N + 1];
... |
01b78040-0761-4235-afd8-2e39293c0e27 | 4 | public InstrumentInfo(String symbol) {
m_symbol = symbol;
final String url = "http://download.finance.yahoo.com/q?s=" + symbol + "&d=t";
try {
Document doc = Jsoup.connect(url).get();
Elements table = doc.select("body table:nth-child(2) > tbody > tr > td > table > tbod... |
3385397b-f9e2-439e-abe1-3d24679d32cc | 7 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof DistanceFilter)) return false;
DistanceFilter other = (DistanceFilter) o;
if (this.distance != other.distance ||
this.lat != other.lat ||
this.lng != other.lng ||
!this.latField.... |
9bca5ef5-04ca-4ebc-aec6-049af68d0afe | 5 | public String get(int i) {
NodoListaDiccionario aux;
if(i>size || i < 0)
return null;
if(i>size/2) {
aux = ultimo;
for(int j = size-1; j>i; j--)
aux = aux.getAnterior();
return aux.getPalabra();
} else {
aux = primero;
for(int j = 0; j<i; j++)
aux = aux.getSiguiente();
return aux.... |
ec6d5705-d27f-44d4-8984-6b9add852209 | 9 | protected void eraseFromScrollItem(Scroll buildingI, Ability theSpell, int level)
{
if(buildingI == null)
return;
StringBuilder newList=new StringBuilder();
for(Ability A : buildingI.getSpells())
{
if(!A.ID().equalsIgnoreCase(theSpell.ID()))
newList.append(A.ID()).append(";");
if(buildingI.isGener... |
b5a98012-c84f-4dbc-9819-8f009cab9315 | 0 | public void setAge(int age)
{
Age = age;
} |
07bd71c1-2e01-4421-8833-ffbc21b08c14 | 7 | private TLanguageFile initSingle( Element node, String workDir, String projectDir)
{
TLanguageFile back = null ;
String filename = node.getAttribute("filename") ;
if (filename != null)
{
if (filename.length() > 0)
{
File workFile = new File( filename ) ;
// file doesn't ... |
5f2a6534-4c09-444d-a372-656fa72899a4 | 2 | public MemberResolver.Method atMethodCallCore(CtClass targetClass,
String mname, ASTList args)
throws CompileError
{
int nargs = getMethodArgsLength(args);
int[] types = new int[nargs];
int[] dims = new int[nargs];
String[] cn... |
d793deb3-2513-4d1b-8791-0ae294c4e19f | 0 | public void setReasonForStopping(String reason) {
reasonForStopping = reason;
} |
35cc79ae-2b92-47de-ad1d-fe3206001113 | 3 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
for(ListIterator<PVar> i = this._var_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != nul... |
fe561049-cfc7-4d40-800f-1292c2cd80f9 | 2 | @Override
public double[][] solve(double[] f, int n, double k, double u, double dt, double dx) {
int m = f.length;
double[][] ans = new double[n][];
ans[0] = f;
for (int i = 1; i < n; i++) {
double[] prevLayer = ans[i - 1], curLayer = new double[m];
for (int j = 0; j < m; j++) {
curLayer[j] = prevL... |
a31fd5e5-a037-4037-b965-7c3c842ced2d | 6 | public void visitIfStmt(final IfStmt stmt) {
if (stmt.trueTarget() == oldDst) {
if (FlowGraph.DEBUG) {
System.out.print(" replacing " + stmt);
}
stmt.setTrueTarget(newDst);
if (FlowGraph.DEBUG) {
System.out.println(" with " + stmt);
}
}
if (stmt.falseTarget() == oldDst) {
if (FlowG... |
9e8d49b6-91e4-490e-acd5-0d1c2f5a4a71 | 7 | @Override
public void setTemperature(int i, int j, double value) {
if (i >= 0 && i < numLongCells && j >= 0 && j < numLatCells) {
cellValues[i][j] = value;
}
// Allow overrunning the "size" of the grid. We are on
// a sphere, after all. This is convenient for checking nei... |
45487c9d-7bc9-4101-8545-463c6886f8a2 | 5 | private void finFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_finFieldActionPerformed
// TODO add your handling code here:
String OneLine;
String word;
int occurrences;
int lines = 0;
int i, j;
StringTokenizer strtok;
HashTable ht... |
f09cb521-fa39-4ba5-ab9e-f9e7cfa1eb91 | 5 | @Override
public void renderControl(Graphics2D g) {
BufferedImage Control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) Control.getGraphics();
if(this.getBackgroundColor() != null)
{
... |
7734db90-fd53-4f91-99cc-0f6bced8dbcb | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
004fdeda-af11-4ee3-b0cf-40c69685034e | 8 | private void balanceAfterInsert(AVLNode<T> node) {
int balanceFactor = node.getBalanceFactor();
if (balanceFactor > 1 || balanceFactor < -1) {
AVLNode<T> parent = null;
AVLNode<T> child = null;
Balance balance = null;
if (balanceFactor < 0) {
parent = (AVLNode<T>) node.lesser;
balanceFactor = pa... |
0b6b430f-d40b-4559-bd7f-6e068e950fda | 5 | public List<Proveedor> getListaProveedor(){
List<Proveedor> ListaProveedor = new LinkedList();
Conexionbd.conexion bd = new Conexionbd.conexion();
List<producto> lp = new LinkedList();
try{
bd.conectarBase();
ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM... |
85489d72-d3f2-48b1-80ea-e027bd69582e | 9 | public void render() {
if(blocksBackground != null){
for(int x = 0; x < blocksBackground.length; x++){
for(int y = 0; y < blocksBackground[x].length; y++){
if(blocksBackground[x][y] != null){
blocksBackground[x][y].render();
}
}
}
}
if(blocksForeground != null){
for(int x =... |
20eb047f-cc4e-443b-aa7d-0ddce3195580 | 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... |
5a59961a-e62e-41e3-afe8-654aabc04e03 | 2 | @Override
public Case getCaseForIA(Joueur joueurAdverse) {
Random rand = new Random();
Case caseTouchee;
int x = rand.nextInt(this._parametre.getNbCaseX());
int y = rand.nextInt(this._parametre.getNbCaseY());
while (((Case) (joueurAdverse.getCases().get(x + y * this._parametr... |
a77aed0e-ba72-4ca4-bb52-04c28caae832 | 8 | public Map<String, TestScript> getTestScripts() throws Exception{
File[] scriptFiles = this.file.getTestScripts();
Map<String, TestScript> allScripts = new HashMap<String, TestScript>();
for(File script : scriptFiles){
ExcelReader reader = new ExcelReader(script);
ExcelModel excel = reader.loadExcel();
L... |
e062f871-a118-4317-b6d2-90d8b80f214c | 4 | public void definirTerrain(int[][] je){
if (jeu.length != je.length && jeu[0].length != je[0].length)
throw new TailleErreur();
for (int i = 0; i<je.length; i++){
for (int j=0; j<je[0].length; j++){
jeu[i][j]=je[i][j];
}
}
} |
f37fe7cc-9c1a-4ca3-a8c6-7820aeb1771f | 1 | public void campaign2Clicked()
{
WindowStack ws = WindowStack.getLastInstance();
System.out.println(ws);
if (ws != null) {
WindowCampaign campaign = new WindowCampaign(2);
ws.push(campaign);
}
} |
b63eb789-574c-4afb-ab80-26338c417909 | 6 | private void select(){
switch(currentChoice){
case 0:
if(!glitches)glitches = true;
else glitches = false;
Player.setGlitch(glitches);
System.out.println(glitches);
System.out.println("2: "+ Player.isGlitch());
break;
case 1:
gsm.setState(GameStateManager.OPTIONSSTATE);
break;
case 2:
... |
65e662db-3dbb-4411-b5d8-46455dc44370 | 5 | public static File getFileChoice(Component owner, String defaultPath,
FileFilter filter, String title) {
//
// There is apparently a bug in the native Windows FileSystem class that
// occurs when you use a file chooser and there is a security manager
... |
0a8836b3-faf3-4674-9386-c59bf5a40328 | 4 | public static void main( String [ ] args )
{
int numItems = 10000;
BinomialQueue<Integer> h = new BinomialQueue<>( );
BinomialQueue<Integer> h1 = new BinomialQueue<>( );
int i = 37;
System.out.println( "Starting check." );
for( i = 37; i != 0; i = ( i + 37 ) % numItems )
if( i... |
744a65db-0ba0-4407-b2e9-3e7d838e4cc6 | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Product product = (Product) o;
if (!productCode.equals(product.productCode)) return false;
return true;
} |
681253ad-cf05-4b1e-8f19-0e55ceafa9de | 2 | public String getColumnName(int column) {
if (column == 0)
return " ";
if (column == terminals.length + 1)
return "$";
return terminals[column - 1];
} |
9763776b-2b3c-4976-a4a8-c75f46daf64b | 4 | public void create(String path) {
// Set base url to the Wiki URL (for images that we didn't catch, etc.)
prince.setBaseURL(config.getBaseUrl());
File output = new File(path).getAbsoluteFile();
File temp = new File(path + ".pdf").getAbsoluteFile();
if(!output.getParentFile().exists())
output.getParentFi... |
d41f522d-a390-42c4-922b-4729a50cb051 | 1 | private int evalState(State s, State ls) {
//attack + defense
int weight[] = {4,4,3};
int atk = weight[0]*attack(s,ls);
int def = weight[1]*defense(s);
int diff = weight[2]*difference(s);
int score = atk + def + diff;
//System.out.println("Attack = "+atk+" | Defense = "+def+" Difference = "+diff+... |
0123a99a-7bfb-42b8-80a0-d0c542513d4e | 1 | protected Integer calcBPB_FATSz16() throws UnsupportedEncodingException {
byte[] bTemp = new byte[2];
for (int i = 22;i < 24; i++) {
bTemp[i-22] = imageBytes[i];
}
BPB_FATSz16 = byteArrayToInt(bTemp);
System.out.println(BPB_FATSz16);
return BPB_FATSz16;
} |
58918842-3a6e-422b-ac50-a67d832b2ad9 | 3 | public void encode(String message) throws IOException {
char[] msgChars = message.toCharArray();
for(int i = 0; i < this.width; i++) {
if(i < message.length()) {
this.picture.setRGB(i, 0, (int) msgChars[i]);
} else {
this.picture.setRGB(i, 0, 0); // Set to nothing
}
}
if(this.filename.getAbsol... |
fddc406f-d9af-4a63-a88d-02174d1f41d0 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Board other = (Board) obj;
if (this.boardHeight != other.boardHeight) {
return false;
... |
0597ed06-35a1-43e4-8d4c-90fa5ce4f58a | 7 | public boolean isValidMove(int startCol, int startRow, int endCol, int endRow)
{
//Works
return ((startRow == endRow && Math.abs(startCol - endCol) <= 1) || (startCol == endCol && Math.abs(startRow - endRow) <= 1) ||
(endCol != startCol && startRow != endRow && ((Math.abs(startRow - endRow) == 1 && Math.abs(s... |
cef17cb7-5ba2-48e4-b10b-5ad837efe0d8 | 7 | public int getScoreEndGame(BufferedImage screenshot) {
// crop score image
BufferedImage scoreImage = screenshot.getSubimage(370, 265, 100, 32);
// transform template images into black-white format
BufferedImage[] endGameNumberTemplates = { extractNumber(_endGame0),
extractNumber(_endGame1), ext... |
71aa0c5b-3f80-4b04-b64c-17f1c9a6a442 | 2 | private boolean jj_3_55() {
if (jj_scan_token(POINT)) return true;
if (jj_3R_72()) return true;
return false;
} |
1b2f82cf-0f33-48ac-b429-823a986cbe97 | 5 | @Override
public boolean executeMouvement() {
Carte carte = null;
int x=0,y=0;
if (Carte.isCreated()){
carte = Carte.getInstance(0, 0, 0, null);
}
if (carte!=null){
x= chevalier.getPositionX();
y=chevalier.getPositionY();
carte.getCartePanel().deplacementPossible(chevalier);
while ((cheva... |
179599db-2cd2-4df4-a312-41c8b367a7f8 | 8 | public void save() {
if (ChristmasCrashers.isDebugModeEnabled())
System.out.println("Saving level " + ID + " in world " + worldID + ".");
File dataFile = new File(getDiskLocation());
if (!dataFile.exists()) {
System.out.println("Data file for level " + ID + " in world " + worldID + " does not exist - creati... |
dc87c826-e16c-4c59-a1da-0f315c11b13d | 0 | synchronized public void terminate() {
gameThread.setMessage(TERMINATE_MESSAGE);
notify();
gameThread.doDelay(25);
board = null;
} |
c13d18ec-308c-40f7-a214-d9a397dc4794 | 9 | public void skillCheck(String attribute, int skill,
int difficulty) {
Result r = Dice.contest(skill, difficulty);
while (r.equals(Result.TIE)) {
r = Dice.contest(skill, difficulty);
}
if (r.equals(Result.FAILURE)) {
switch (attribute) {
case "stamina":
pc.increaseStat(AbilityType.STAM... |
64fae314-e958-4c8f-9811-51651928bd63 | 1 | public boolean canStart() {
return !(isStarted || preStart);
} |
97af7d35-cc9b-4ed5-a913-7225f2319e87 | 9 | private void injectObject() {
for(BeanDefinition beanDefinition : beanDefines){
Object bean = sigletons.get(beanDefinition.getId());
if(bean!=null){
try {
PropertyDescriptor[] ps = Introspector.getBeanInfo(bean.getClass()).getPropertyDescriptors();
for(PropertyDefinition propertyDefinition : beanD... |
d2cdd356-81e1-40dc-a933-9a405b2604bf | 6 | private void stopPosition() {
StreamsterApiInterfaceProxy proxy = new StreamsterApiInterfaceProxy();
Position[] positions = new Position[0];
try {
positions = proxy.getPositions();
} catch (RemoteException ex) {
Logger.getLogger(JobTradeUpGBPJPY.class.getName()).l... |
5f9799bb-4e78-4f7f-a5dd-0d67e16d4354 | 5 | public void addTile(Tile tile) {
//Si la pioche a ete verrouillee
if (isClose)
return ;
//Si il s'agit d'une pioche ouverte
if (isOpen && tile != null) {
JLabel tmp = new JLabel(tile.getIcon());
tmp.addMouseListener(this);
this.tileList.put( tile.getType(), tmp);
}
//Apparence de la pioche... |
800d58f1-e5fb-40c7-a076-635ddc117548 | 5 | private DetachedCriteria makeCriteria(Map<String, Object> condition) {
DetachedCriteria criteria = DetachedCriteria.forClass(Class.class);
if (condition == null) {
return criteria;
}
criteria.createAlias("grade", "g");
criteria.createAlias("g.specialty", "s");
... |
12266279-5472-49d1-b8a8-2679fff1b28c | 0 | public PrimitiveUndoableMove(CompoundUndoableMove undoable, Node node, int index, int targetIndex) {
this.undoable = undoable;
this.node = node;
this.index = index;
this.targetIndex = targetIndex;
} |
5d195972-e978-49ee-bf49-d3273f58d5d6 | 8 | public void die()
{
xDeathPos = (int) x;
yDeathPos = (int) y;
world.paused = true;
deathTime = 1;
Art.stopMusic();
world.sound.play(Art.samples[Art.SAMPLE_MARIO_DEATH], this, 1, 1, 1);
if(world.recorder != null){
if(running)
world.recorde... |
3382ca3d-2d1b-47c1-a62c-80eca3c2a0b1 | 3 | private void checkMaxFlow(long vID, IAIGraph yolo) {
// die drei beispielgraphen sind so gebaut, dass
// der maximale flow bei graph 9 und graph 20
// daran ueberprueft werden kann, ob alle von der Quelle
// ausgehende Kanten voll ausgeschoepft sind
// unser graph 21 wurde so gebaut, dass er mit eiem sc... |
1d1f0cfa-71ab-432e-899c-ca12df0faa31 | 6 | public void drawRadar(FrameBuffer buffer, Car car) {
float xf=0;
float zf=0;
SimpleVector carPos=car.getTransformedCenter();
SimpleVector temp=new SimpleVector();
float rot=car.getDirection();
float dx=(float) buffer.getOutputWidth()/10f;
float dy=(float) buffer.getOutputHeigh... |
225383f0-9a14-4581-bfe5-bab685afd445 | 9 | private void scrollAndAnimateBy(int increment) {
if (scrollerTimer == null || !scrollerTimer.isRunning()) {
int index = itemIndex + increment;
if (index < 0) {
index = 0;
} else if (index >= dataModel.getSize()) {
index = dataModel.getSize() - ... |
66c17df2-e5f9-4a89-9cda-5e8db95066af | 5 | public void updateStockPrices() throws Exception{
PreparedStatement ps = null;
ResultSet rs = null;
List<String> tickers = new ArrayList<String>();
boolean oldAutoCommitState = con.getAutoCommit();
con.setAutoCommit(false);
//Gets List of Stock Tickers
try {
ps = _preparedSta... |
c60c9b77-845e-4adf-94d7-fc018a366bc0 | 8 | public void editCard()
{
if (selectedCard != null)
{
if (selectedCard instanceof HeroFrontCard)
{
frame.newWindow(CreatorFrame.FILE_NEW_HERO_FRONT, selectedCard);
}
if (selectedCard instanceof HeroBackCard)
{
frame.newWindow(CreatorFrame.FILE_NEW_HERO_BACK, selectedCard);
}
if ... |
b66fb009-5ef0-4268-aa09-a43964da0a34 | 1 | private static Properties loadProperties() throws Exception {
InputStream stream = Version.class.getResourceAsStream(POM_PATH);
Properties props = new Properties();
try {
props.load(stream);
return props;
} catch (Exception ex) {
throw ex;
}
... |
b053b3a8-129c-44bd-a962-ea16a717d3d6 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Salle other = (Salle) obj;
if (this.id != other.id) {
return false;
}
if ((th... |
7e5b6a09-6638-45c4-9e28-396f187122d8 | 4 | public BufferedImage renderPrepared(int px, int pz, int sx, int sz, double min, double max)
{
BufferedImage res = new BufferedImage(sx, sz, BufferedImage.TYPE_INT_RGB);
double[] data = get2DData(px, pz, sx, sz);
for(int x = 0; x < sx; x++)
for(int z = 0; z < sz; z++)
... |
cc970716-eb2a-4782-801e-3406efcc0cbd | 1 | private void setTransform(boolean slide) {
if(slide) {
slideTransform.x = getBounds().getX();
slideTransform.y = getBounds().getY();
} else {
slideTransform.x = (getBounds().getX() + (getBounds().getWidth() * value) - (SpriteList.get(sliderKnob).getWidth() / 2f));
slideTransform.y = getBounds().getY();
... |
8351b62f-c6fb-495f-adba-9910815a18bc | 6 | public static void main(String[] args) {
if (args.length <= 0) {
System.out.println("At least one arg (pebbler project) must be" +
"specified");
}
// Quarter-assed flag parsing.
String projectFileName = args[0];
String nextFlag = args.length > 1 ? args[1] : "";
boolean createBoo... |
7124da5b-2f6b-4020-9af6-84046ad44d83 | 2 | @Override
protected MultiLevelCache getCurrentLevelCache(String poolName) {
String upperCase = poolName.toUpperCase();
SockIOPool pool = SockIOPool.getInstance(upperCase);
if (!pool.isInitialized()) {
try {
initializePool(pool);
} catch (Exception e) {
throw new CacheUnreachableException("创建Memcach... |
b697bec4-bd42-4088-8955-f231aa7c544d | 7 | private String[] findLinks(String pageHTML, String currentPageURL){
System.err.println("FindLinks : " + pageHTML);
ArrayList<String>links = new ArrayList<String>();
//imgur has changed their html classes, we'll use this to make changes easier
String postDelimiter = "id=\"imagelist";
if(pageHTML.contains... |
84890313-c3c9-4fe8-8bd2-4c5c0ac14883 | 9 | public void drawTrade(Graphics g)
{
g.setColor(new Color(255,126,0,200));
g.fillRect(0,0,getWidth(),getHeight());
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawString("You",50,70);
try
{
for(int i=0; i<partyPokemon.length; i++)
{
if(partyPokemon[i]!=null)
g.... |
4c4a281b-3332-4588-ac72-b67eca97b7d8 | 4 | private static void handle(String argument) {
System.out.println("Handling '" + argument + "':");
Path path = Paths.get(argument);
if (!Files.exists(path)) {
System.out.println("The file '" + path + "' does not exist.");
return;
}
Element diagram;
try (XMLParser parser = new XMLParser(path)) {
... |
0210492d-eb0f-4618-9f81-a451a5c12bbb | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
684f4f1e-bb72-43a9-8a76-8a5ff1e3b763 | 1 | public void append(String msg) {
if (win==true){textarea.append(msg+"\n");}
else{System.out.println(msg);}
} |
aea2f156-7ee7-497c-8c63-d99da502a0c1 | 0 | @Override
public Tile getTile() {
return tile;
} |
9049cca5-64b4-4d4a-8f68-c68fb8f8597f | 0 | public AnswerCombination getAnswerCombinationFromGameMaster(Combination<Colors> attempt) {
return master.answer(attempt);
} |
0b1566ea-b3b6-4889-9562-52b85e4026a9 | 1 | @Test
public void testSerialization() throws IOException{
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
ObjectOutputStream objOutput = new ObjectOutputStream(byteOutput);
objOutput.writeObject(alan);
objOutput.close();
ObjectInputStream objInput = new ObjectInputStream(new ByteArrayInputStr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.