method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ccfc0227-ad56-4f40-bb4a-e1a225033c26 | 5 | @Test
public void testSetQueueTimeoutDisconnect() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSetQueueTimeoutDisconnect -----");
String client_hash = "";
String client_hash2 = "";
try {
server2.setUseMessageQueues(true);
} catch (TimeoutException e) {
... |
81de18fc-0360-4f5e-8e5d-8345f93ccd43 | 5 | @Override
public void recvFileTransfer(String seller, String serviceName, byte[] fileContent) {
loggerNetwork.info("Receive file from seller " + seller +
" from service " + serviceName);
String filename = seller + "_" + serviceName;
int toWrite;
int noChunks = fileContent.length/NetworkInfo.BUF_SIZE;
... |
818c1db0-3c3b-4595-8d93-b227af33615b | 7 | private String printResults()
{
String strReturn = "\t\t\t//to print out the results.\n";
strReturn += "\t\t\tSystem.out.printf(\"";
String tmpOutputFormat = new String();
for(int i = 0; i != this.mfstructOrig.lst_Grouping_Attr.size(); i++)
{
strReturn += "%-14s";
tmpOutputFormat += "%-14s";
}
for... |
f1722ee7-9ed9-45bd-bcad-edf68580a6ff | 5 | static final void method573(SubNode class348_sub42,
SubNode class348_sub42_15_, byte i) {
try {
if (((SubNode) class348_sub42).subnodeChild != null)
class348_sub42.removeSubnode();
anInt8680++;
((SubNode) class348_sub42).subnodeChild
= class348_sub42_15_;
((SubNode) class348_sub42).subnodeP... |
386791d4-b35c-4cb0-aa0e-ac88c53773e7 | 4 | public boolean avoidAsteroid(){
boolean hit=false;
for(int b=0;b<objects.size();b++){
if(objects.get(b).kind!=0)
continue;
boolean obstacle = collisionCircle((int)(x+vx),(int)(y+vy),h/2,(int)(objects.get(b).x),(int)(objects.get(b).y),(int)(objects.get(b).h/2));
... |
8975fe07-39f1-428b-a3fa-828d6eddf6b0 | 4 | public static String arrayToDelimitedString(Object[] arr, String delim) {
if (SpringObjectUtils.isEmpty(arr)) {
return "";
}
if (arr.length == 1) {
return SpringObjectUtils.nullSafeToString(arr[0]);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
if (i > 0) {
sb... |
e200087f-4443-41e5-a8aa-3a5f423326fa | 0 | public void setPcaGrupo(Integer pcaGrupo) {
this.pcaGrupo = pcaGrupo;
} |
93168e18-864b-43c6-8d6f-011e34878fe2 | 7 | public void setUpGame( ArrayList<String> names )
{
int initArmies = 0;
ArrayList<Player> tempPlayerList = new ArrayList<Player>( this.playersCount );
if( this.playersCount == 2)
initArmies = 60;
else if( this.playersCount == 3)
initArmies = 35;
else if( this.playersCount == 4)
initArmies = 30;
e... |
2c55f875-dd5e-4ae0-96d5-01601e808dc4 | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
95ec50ad-4930-4534-b9e8-51dcb959577e | 3 | private void ButtonActions() {
play1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.dispose();
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStac... |
6cbb7252-fdd4-423f-89d1-eaf5763dbbda | 3 | void generateCounts(Field field)
{
reset();
for(int row = 0; row < field.getDepth(); row++) {
for(int col = 0; col < field.getWidth(); col++) {
Object animal = field.getObjectAt(row, col);
if(animal != null) {
incrementCount(animal.getC... |
8e8d6316-2c3b-4169-a206-29b55335d9b6 | 7 | protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("SWITCH_COLOR".equals(PROPERTY)) {
background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");
} else if... |
a30f9055-3558-4a23-8df3-55065fe0fe85 | 8 | public static void main(String[] args) {
TftpServer server;
try {
server = new TftpServer();
server.setDaemon(true);
server.start();
} catch (SocketException e2) {
System.err.println("Failed to create server.");
e2.printStackTrace();
return;
}
System.out.println("\n\tTesting out parallel ... |
48e173f4-348e-4983-8180-4646bd619bff | 4 | private String moveDirection(Player player)
{
String returned;
switch (directionCom) // finds direction to move and moves user
{
case 'N':
returned = player.currentRoom.moveNorth(player);
return returned;
case 'S':
... |
5f009918-3d2f-4b05-acc6-5034dd9da418 | 5 | private String getNextCodeBlock(){
if(nextLine >= buffer.length)
return null;
String s = buffer[nextLine] + "\n";
String parts[] = buffer[nextLine++].split("[\\s]*:=[\\s]*");
if(parts[0].equals("return")/* ||
parts[0].equals("goto") ||
parts[0].equals("call")*/){
return s;
}
while... |
562fe435-48ec-4504-b4dd-1ec6bda41f5c | 1 | private boolean jj_3_33() {
if (jj_3R_50()) return true;
return false;
} |
ee5b57dd-c7ea-4324-8777-488f82eea66b | 0 | @Basic
@Column(name = "LOG_ID_SOLICITUD")
public int getIdSolicitud() {
return idSolicitud;
} |
7f022c32-198c-4374-b680-ce7e115a3f0b | 8 | public String infix()
{
if(child.size() > 0)
{
if(!isFunc)
{
String str = "";
if(data.equals("-"))
str = "-";
for(int i =0; i<child.size()-1; i++)
{
if(child.get(i).child.size() > 0)
str+="("+child.get(i).infix()+")"+data;
else
str+=child.get(i).infix()+data;
}
... |
4a4e527a-0e72-4c7c-8c2d-a315180f0da5 | 6 | public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int testCase = 0;
StringBuilder sb = new StringBuilder();
while (sc.hasNext()) {
char s[] = sc.next().toCharArray();
int Q = sc.nextInt();
testCase++;
sb.append((... |
b41aaf7b-0b8f-4efe-9a93-8818db5ad1f3 | 5 | public static boolean checkPlayerData(String name) throws IOException, ParserConfigurationException, TransformerException {
File f = new File("./plugins/professions/data/" + name + ".xml");
if ( !f.exists() ) {
try {
boolean fs = f.createNewFile();
if( fs ) {
PluginLogger.getLogger(JavaPlugin... |
7c882097-3e1c-4a5a-97c8-ffc79bef0302 | 2 | public String checkVersion(File file) {
String v = null;
if (fileName.endsWith(".xls")) {
v = "2003";
} else if (fileName.endsWith(".xlsx")) {
v = "2007";
}
return v;
} |
6ab4623a-b670-452e-a588-d2e91552831a | 4 | public boolean equals(Object object) {
if (! (object instanceof ByteArray))
return false;
if (bytes.length != ((ByteArray) object).bytes.length)
return false;
for (int i = 0; i < bytes.length; i++)
if (bytes[i] != ((ByteArray) object).bytes[i])
... |
3b8692c4-4a99-43d0-a1d4-867f4a7b199d | 0 | public static void setup() throws SQLException {
Hive hive = new Hive();
hive.execute("DROP TABLE IF EXISTS trx");
hive.execute("CREATE TABLE trx(product_key STRING, customer_key STRING, price FLOAT, trx_date TIMESTAMP)");
} |
6048de93-4f48-48b1-a073-9066ef3bd0e2 | 4 | private void acceptQueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptQueryActionPerformed
boolean error = false;
String errorString = "";
Object[] what = new Object[5];
what[0] = enableConectionquery.isSelected();
if (!userDataQuery.getText().equalsIgno... |
ffaf2c7b-658e-4520-8d16-11557a617d5d | 2 | @Override
public void run() {
// Show the GUI
setVisible(true);
// Update the time in near real time
while (dataShare.isRunning()) {
try {
updateTime();
updateBpm();
startAlarms();
setConnection();
... |
c448ad85-453b-4e99-aa43-f664a0a2003e | 3 | protected void attackBlockedEntity(Entity var1, float var2) {
if(!this.worldObj.multiplayerWorld) {
if(this.timeSinceIgnited > 0) {
this.setCreeperState(-1);
--this.timeSinceIgnited;
if(this.timeSinceIgnited < 0) {
this.timeSinceIgnited = 0;
... |
6570d70e-cf10-4a76-a576-3341489905ec | 1 | public static ImageProcessor newProcessor(File file) {
ImageProcessor ip = null;
if (file != null) {
ImagePlus iplus = new Opener().openImage(file.getAbsolutePath());
ip = iplus.getProcessor();
}
return ip;
} |
bfe968d1-7ea6-4df9-9e33-3704ddcf8efd | 0 | public void deleteData() {
} |
1b417416-0674-4e3c-bdbc-34803f652b95 | 2 | public static List<String> tokenize( String line )
{
List<String> tokens = new LinkedList<String>();
Pattern pat = Pattern.compile( "[a-zA-Z]+|[0-9]*\\.[0-9]+|[0-9]+|[\\+\\-\\^\\*/#\\(\\)]" );
Matcher match = pat.matcher( line );
while ( match.find() ) {
tokens.add( line.substring( match.sta... |
30854129-b2fe-4dc7-9f19-b52785963627 | 5 | public static void walk(final Tile... path) {
if(!Walking.isRunEnabled()) {
if (Walking.getEnergy() > Random.nextInt(30, 50)) {
Walking.setRun(true);
Task.sleep(400, 500);
}
}
for (int i = path.length - 1; i >= 0; i --) {
if (Ca... |
be23490d-08bd-4f8a-9a0e-c46173b736bb | 8 | public void gererCommande()
{
Iterator<Tas> iterator;
Tas tasCourant;
int positionLaPlusPetite;
for(int i = 0; (this.enFonctionnement == BOUCLE_INDETERMINEE || i < this.enFonctionnement) && this.enFonctionnement != BOUCLE_STOPPEE; i++)
{
// On informe que l'on vas entrer dans un tick
this.notifyWaitTic... |
79e46968-e561-4044-884c-f474f500a65c | 9 | public static void main(String[] args) {
DiscCollection collection;
// Wieviele CDs sollen gespeichert werden?
System.out.print("Normalerweise kannst du 100 CDs in der Sammlung speichern.\n" +
"Moechtest du diese Anzahl aendern? (j/N) ");
if(Console.readString().equalsIgnoreCase("j")) {
System... |
a594670e-67f8-4313-be99-bc8bf1a09115 | 9 | public void setSize(int size, Graphics2D g2) {
if( curSize != size ) {
// System.out.println("Set size of " + getDebugName() + " to " + size);
Rectangle2D newBounds;
if( size == getMaxSize() ) {
newBounds = defaultBounds;
} else if( size == getMinS... |
ef4c33d1-af45-4bc7-9e74-59010df4c530 | 3 | protected void paintProvince(Graphics2D g, int provId) {
final String goods = mapPanel.getModel().getHistString(provId, "trade_goods");
if (goods == null) {
mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST);
} else if (goods.length() == 0 || goods.equalsIgnoreCase("none")) {... |
4357df73-db6f-4045-9884-5246e6b010d0 | 3 | public int getUserIdByName(String name) {
if(Users.getUsersOnline() == null) return -1;
for(NetworkSharedUser nsu : Users.getUsersOnline()) {
if(nsu.getName().equalsIgnoreCase(name)) {
return nsu.getId();
}
}
return -1;
} |
abfb779f-2503-4d18-a950-f29248a7db8d | 1 | public Map(Player p, int sizex, int sizey) {
this.sizex = sizex;
this.sizey = sizey;
player = p;
levels = new ArrayList<Level>();
for (int x = 0; x < 10; x++) {
levels.add(new Level(p, levels, x, sizex, sizey));
}
currentLevel = levels.get(0);
} |
efabb3bf-97eb-4740-9615-49c7d11365a5 | 9 | public int numOfDups(String[] words) {
if (words.length == 0) {
return 0;
}
Hashtable<String, Integer> hash = new Hashtable<String, Integer>();
int counter = 0;
for (int i = 0; i < words.length; i++) {
if (!hash.containsKey(words[i])) {
hash.put(words[i], 1);
} else {
int c = hash.get(words[i... |
c9b23207-a973-4b0c-9875-2ed7fca1bca3 | 2 | public Component(int rotation, int x, int y,int w, int h, double resistance, double emf) {
super();
this.setSize(w,h);
this.setLocation(x,y);
this.rotation = rotation;
this.resistance = resistance;
this.emf = emf;
this.x = x+100;
this.y = y+100;
if... |
80f73931-429e-4032-8135-f3f760aa60d3 | 8 | private void readDocTypeDecl() throws ParseException, IOException {
readSymbol(DOCTYPE_BEGIN);
readS();
docTypeName_ = readName();
if (isS()) {
//either at (1) or (2)
readS();
if (!isChar('>') && !isChar('[')) {
//was at (1)
isExternalDtd_ = true; //less checking of ent... |
de3188e4-6836-4c2b-9ab9-ecc6f5210c34 | 4 | @EventHandler(ignoreCancelled = true)
public void spawn(CreatureSpawnEvent cse) {
ReinforcementManager reinforcementManager = Citadel.getReinforcementManager();
EntityType type = cse.getEntityType();
if (type != EntityType.IRON_GOLEM && type != EntityType.SNOWMAN) return;
for (Block bl... |
4f1dc3aa-85ee-46da-85c2-83922412808d | 7 | public void start()
{
printlnToAll();
printlnToAll("--- GAME STARTED");
printlnToAll();
while(end == false)
{
printlnToAll("Game turn " + (counter + 1) + " :");
boolean gameTurnComplete = false;
currentTurn = new StandardTurn(this, turnSequence.getFirstCharacter());
while (gameTurn... |
65da6716-7f90-4fec-99c3-eaf7a0fbdbde | 9 | public void showDialog(final String fileName, final String description, final File file) throws IOException {
final JDialog dialog = new JDialog((JFrame) null, Messages.getString("PandaDownload.title"), true);
JPanel panel = new JPanel(new BorderLayout(5, 5));
String descLine = "";
if (... |
215bded8-8fa1-453e-bf34-059e5f958822 | 1 | public void render()
{
if(isRunning)
{
level.render();
}
} |
78c8f493-c6e0-440b-9c13-d02fe8f6e849 | 2 | public final JSONObject append(String key, Object value)
throws JSONException {
testValidity(value);
Object o = opt(key);
if (o == null) {
put(key, new JSONArray().put(value));
} else if (o instanceof JSONArray) {
put(key, ((JSONArray)o).put(value));
... |
2e60d438-dc45-46cd-8a32-32b8264c4b1a | 0 | public GUITreeComponent get(String name) {
return (GUITreeComponent) reg.get(name);
} |
1024ca44-cd53-47ca-b803-ec9d35b36fd2 | 4 | public Position getVisibleMapOffsetPosition(Player player) {
int offsetXObject = player.x - (int) Math.ceil(Realm.MAP_WIDTH / 2);
int offsetYObject = player.y - (int) Math.ceil(Realm.MAP_HEIGHT / 2);
if (offsetXObject < 0)
offsetXObject = 0;
if (offsetYObject < 0)
offsetYObject = 0;
if (offsetXObject... |
65baaf3e-4b99-4ded-a9e6-2fc64f05fd42 | 4 | @Override
public void render(Document html, Element node) {
Element inputNode = html.createElement("input");
if (getCodedContentCollection() != null) {
inputNode.setAttribute("data-codedcontent-default-val", value);
}
inputNode.setAttribute("value", value);
inputN... |
273dac43-bbfc-4c53-8891-7d4eb7a82314 | 9 | BigDecimal parseFactor() {
BigDecimal v;
boolean negate = false;
eatSpace();
if (c == '+' || c == '-') { // unary plus & minus
negate = c == '-';
eatChar();
eatSpace();
}
if (c == '(') { // brackets
eatChar();
v = parseExpression();
if (c == ')')
eatChar();
} else { // numbers
Str... |
f4f84ae3-f5d3-4f80-b853-e2f40eb79f51 | 2 | public void setStandardButtonPadding(int[] padding) {
if ((padding == null) || (padding.length != 4)) {
this.buttonStd_Padding = UIPaddingInits.STD_BTN.getPadding();
} else {
this.buttonStd_Padding = padding;
}
somethingChanged();
} |
91b1e251-11ab-49a6-8c89-b5d71472b468 | 9 | public static void select(User currUser, Tables tables, Statement stmt,
String query) {
Iterator tableIter = tables.getIter();
List<String> views = new LinkedList<String>();
ResultSet rset;
while (tableIter.hasNext()) {
String table = (String) tableIter.next();
if (query.toUpperCase().contains(tabl... |
69c5a5cc-51a6-4427-810b-2c1701614fa5 | 8 | public static int hg_step3(int step, int[][] mask, int[] colCover)
{
//What STEP 3 does:
//Step 3 works on the mask matrix only. It examines each column and if
//the column has a starred zero, then it covers it. If k columns are
//covered, where k is min(rowsOfInputtedArray, colsOfInputtedArray),then
//we go... |
49af972c-91c6-49ac-b14e-c4ebda35ece9 | 4 | public void computeLCS()
{
for (int i = 1; i < seq1.length; i++) {
for (int j = 1; j < seq2.length; j++) {
if (seq1[i] == seq2[j]) {
length[i][j] = length[i-1][j-1] + 1;
indices[i][j] = I * (i-1) + j-1;
} else if (length[i-1... |
904e09f5-a706-4d79-92c6-7f08defaaf47 | 2 | public List<ItemVenda> listarTodos(int idVenda) throws ErroValidacaoException, Exception{
try{
PreparedStatement comando = conexao
.getConexao().prepareStatement("SELECT * FROM itens_venda WHERE id_venda = ?");
comando.setInt(1, idVenda);
ResultSet consult... |
28944ad6-915b-448d-bc9e-28ca05829cb2 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
d987f4b5-44fc-436a-ac93-6163d8dff138 | 6 | public void draw(GOut g) {
Fightview.Relation rel = fv.current;
if (rel != null)
g.image(scales[(-rel.balance) + 5], Coord.z);
g.image(sword, Coord.z);
if (fv.off >= 200) {
g.chcolor(offcol);
g.frect(moc, new Coord(-fv.off / 200, 5));
}
... |
ce9b82a7-7d05-43d3-8b67-af257e85dc43 | 8 | private static Alignment traceback(Sequence s1, Sequence s2, Matrix m,
byte[] pointers, Cell cell, short[] sizesOfVerticalGaps,
short[] sizesOfHorizontalGaps) {
logger.info("Started...");
long start = System.currentTimeMillis();
char[] a1 = s1.toArray();
char[] a2 = s2.toArray();
float[][] scores = m.... |
5f4677a0-3558-4238-95a1-a18e7fdebcac | 2 | public static Decimal avgWithAPI(IDecimal... values)
{
if (values.length == 2)
{
return (Decimal) values[0].add(values[1]).divide(Decimal.valueOf(2, 0));
}
else
{
Decimal sum = Decimal.valueOf(0);
for (IDecimal d : values)
{
sum.add(d);
}
return sum.divide(Decimal.valueOf(values.length, 0));
... |
343d245f-481c-40c3-85d3-c262f66a7425 | 8 | protected void search(String fileName){
startOutput(fileName);
while(!cobweb.getUnsearchQueue().isEmpty()){
final WebPage wp = cobweb.peekUnsearchQueue();// 查找列隊
//初始節點
if(wp.getDepth() == 0){
try {
leavesNodeFileWriter.write(wp.getUrl() + " ,level=" + wp.getDepth() + CrawlResultFormat.ln);
... |
25351f07-9197-4dbf-a22e-eea3d9f3bc1c | 7 | public int minCut(String s) {
int length = s.length();
boolean[][] matrix = new boolean[length][];
int[] f = new int[length + 1];
for(int i = 0; i < length; ++i){
matrix[i] = new boolean[length];
// matrix[i][i] = true;
}
for(int i = 0; i <= length; ++i){
f[i] = length - i - 1;
}
for(int ... |
9b812b78-6679-4d9c-9090-40a5cc6c1894 | 7 | private static ArrayList<String> alphabetize(ArrayList<String> list) {
int numWords = list.size();
// Change the case of all words in the list to lowercase.
for (int i = 0; i < numWords; i++) {
String s = list.get(i);
if (s != null)
... |
c8c0e020-d19b-4028-a9ac-f87907ae2c98 | 6 | public void processQueue(int time, Simulator sim) throws VehicleException, SimulationException {
for (int i = 0; i < queue.size(); i++) {
Vehicle v = queue.get(i);
if(!(v.isQueued()))
throw new VehicleException("Vehicle not in correct state");
if(time > Constants.CLOSING_TIME || time < 0)
throw new ... |
8cb606f3-601a-4d24-a972-cbeedd59fdd4 | 6 | public Compiler(String filepath, Program program) {
try {
this.parser = new CecilParser(new CommonTokenStream(new CecilLexer(new ANTLRFileStream(filepath))));
this.parser.initialise();
this.sim40 = parser.getSimulator();
/* Parsing */
try {
this.parser.program();
this.sim40.setLineNumbers(pr... |
fc0504ec-3f70-4640-8c29-c1816b9e9d3b | 6 | public AABB getAABB(int level, int x, int y) {
if (x < 0 || y < 0 || level < 0 || level > collisionMap.length || x >= collisionMap[0].length || y >= collisionMap[0][0].length)
return null;
return collisionMap[level - 1][x][y];
} |
b49999b0-85db-46b1-874e-56f5f80c1a5a | 1 | private void alustaRaajojenKoordinaatit(){
Raaja raaja1;
Raaja raaja2;
for(int i=0; i<4; i++){
raaja1 = hahmo1nRaajat[i];
raaja2 = hahmo2nRaajat[i];
ekanJuuri[i][0] = raaja1.getX();
ekanJuuri[i][1] = raaja1.getY();
ekanJuur... |
1c0f7966-4988-4cfe-82a0-3b332ca124fe | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
63c74c88-1f91-4041-ad0a-959f46a14802 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
MarkupErrorReporterMock other = (MarkupErrorReporterMock) obj;
if (addCalled != other.addCalled) return false;
if... |
e0524ed0-1917-40f3-87bd-d42062aaf9dc | 7 | private void runBtMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_runBtMouseClicked
// TODO add your handling code here:
int numVoters = Integer.parseInt(numVotersTF.getText());
int numCans = Integer.parseInt(numCandTF.getText());
List<Candidate> cans = n... |
82958336-ae55-4e62-b602-dc96f3d24454 | 7 | public String toString(){
//String separator = ";";
String res =aspect; // = aspect + separator;
if (modifier!= null && modifier.equals(BLOCK)) {
res+=BLOCK_TOKEN+secondAspect+SEPARATOR;
} else
if (modifier!= null && modifier.equals(JUMP)) {
res+=JUMP_TOKEN+secondAspect+SEPARATOR;
} else res+=SEPA... |
d105c16c-8d13-4107-b320-4deac70a7bee | 0 | private Combination<Colors> generateAttemptCombination9() {
List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>();
attemptTokens.add(new Token<Colors>(Colors.Y));
attemptTokens.add(new Token<Colors>(Colors.O));
attemptTokens.add(new Token<Colors>(Colors.B));
attemptTokens.add(new T... |
cfc4e26f-9b72-42ad-ae80-c730e1a7700c | 3 | public ArrayList<Vector> getRayCollisions(Edge otherEdge) {
ArrayList<Vector> intersections = new ArrayList<Vector>();
Vector intersection;
for(Edge edge : edges) {
intersection = edge.getIntersection(otherEdge, false);
if(intersection != null) {
intersections.add(intersection);
}
}
return inters... |
8f1271c6-a32e-491f-a417-5513963f7055 | 6 | @Override
public void setupSurface(Surface surface, Face direction) {
//set bounds for the surface
surfaceX = surface.roomView.boundX;
surfaceWidth = surface.roomView.width;
if (surface.roomView.sidePassage){
/*
* override for sidepassages.
* when using the skew feature of javaxt, we must only use... |
f5c85bd2-58ea-4606-9c76-d19891b1ffe4 | 0 | public static void consolePrint(String message) {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy h:mm:ss a");
String formattedDate = sdf.format(date);
System.out.println("[System @ " + formattedDate +"] " + message);
} |
2c913c12-2a3d-4a62-a5d5-99857d9904ba | 8 | @Override
public Set<SnapShotObject> handleEvent(InputEventDescriptor eventDescriptor, SnapShot snapShot, float time) {
Collection<SSOId> targetIds = eventDescriptor.getInputEvent().getTargetIds();
if(targetIds == null || targetIds.size() != 1) {
return null;
}
S... |
ea22c718-d508-4ec0-b3db-a01f96947a8c | 4 | @Override
protected Object getColumnValue(AcceptedOrder order, int columnIndex) {
switch (columnIndex) {
case 0:
return order.getId();
case 1:
return order.getDateStamp();
case 2:
return order.getTimeStamp();
case 3:
return order.getTotal();
}
throw new IllegalArgumentException("Column index ... |
e363724c-805c-484b-b760-b573adcab200 | 7 | public Level(String string) {
InputStream is = getClass().getResourceAsStream("level1.txt");
Scanner sc = null;
sc = new Scanner(is);
player = new Player(sc.nextFloat(), sc.nextFloat());
int i = sc.nextInt();
while (i > 0) {
float tX = sc.nextFloat();
float tY = sc.nextFloat();
float bX = sc.nextFl... |
062ba6c4-d4f8-4ad6-a1ab-5ae7c445042c | 0 | @Override
public void checkLink(String link) {
addUnsearchList(link);
} |
5e4ac614-534a-44de-84ca-59a0c4d35859 | 0 | public void loadWorld()
{
chunkLoader.beginLoading();
generateWorld();
} |
0aab0650-2923-462c-b194-3a05d530bd52 | 5 | @Override
public W<DeltaPair<Delta,Delta>> delta(DC obj)
{ if(obj instanceof Pair)
{ Pair that=(Pair)obj;
if(this.s.instanceOf(that.s) && this.t.instanceOf(that.t))
{ W ws=this.s.delta(that.s);
W wt=this.t.delta(that.t);
if(ws.equa().getValue() && wt.equa().getValue())
... |
d19c48c2-06e0-4ff7-81bd-63e6f1077b3e | 5 | private boolean initialize(int numOfRows, int numOfColumns) {
if (isInitialized) {
Iterator<List<Passenger>> rowIterator = passengerList.iterator();
while(rowIterator.hasNext()){
List<Passenger> _passengers = rowIterator.next();
for (int i = 0; i < _passen... |
e0d406d3-b5bb-4a9a-a514-87cabf8ebf9f | 1 | public static void main(String[] args) {
Teacher_DAO teacher_DAO = new Teacher_DAO();
if (teacher_DAO.Exist("10060120", "jjhsjl")) {
System.out.println("hahahhah");
};
} |
d2a94aa8-be42-49f9-ad49-a49890b06021 | 3 | private InputMode getModeFromHotkey(int x) {
AbilityType selected_ability = game.playerHandler.getAbilityFromHotkey(x);
InputMode imode = AbilityType.abilityInputMode(selected_ability);
if (imode == null) {
return MOVEMENT;
}
switch (imode) {
case AIM:
... |
e0a84a09-bdb5-4481-9c8f-5c6c7fd754e0 | 2 | public static void copyRecursive(File sourceDir, File targetDir) throws IOException {
targetDir.mkdirs();
for(File f : sourceDir.listFiles()) {
if(f.isDirectory()) {
copyRecursive(f, new File(targetDir, f.getName()));
}
else {
FileInputStream fis = new FileInputStream(f);
FileOutputStream fos =... |
8d7cad1a-44b8-458d-9aee-45b3123505ca | 5 | private int idxContact(InetAddress iaIn)
{
int iOut = -1;
int iCnt = 0;
int iLen = this.getSize();
EzimContact ecTmp = null;
if (iaIn != null)
{
try
{
InetAddress iaTmp = this.normalizeAddressIfLocal(iaIn);
synchronized(this.list)
{
for(iCnt = 0; iCnt < iLen; iCnt ++)
{
... |
c0a089f1-9e83-4a7f-8575-74f7e7494603 | 1 | private boolean editEntry()
{
try {
rs.updateRow();
return true;
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return false;
} |
6428113e-f4f6-4a58-a060-2a514a63d64c | 1 | public static void main(String[] args) {
try {
Data d = Reader.getDataFromFile(new File("files/restaurant3.arff2"));
ID3.verbose = true;
Tree tree = ID3.decisionTreeLearning(d.getExamples(),
d.getAttributes(), d.getGoalAttribute(),
d.getattributeValues(), null);
System.out.println(tree);
Syst... |
8582f1e2-5b27-4eab-b677-73a68c87b6db | 9 | public void poll(int width, int height) {
// add any listeners requested since last time
for (int i=0;i<keyListenersToAdd.size();i++) {
addKeyListenerImpl((KeyListener) keyListenersToAdd.get(i));
}
keyListenersToAdd.clear();
for (int i=0;i<mouseListenersToAdd.size();i++) {
addMouseListenerImpl((MouseLis... |
d84d0068-c6d6-4ff3-a85e-59858fdcefd1 | 4 | @Override
public void menuSelected(MenuEvent event) {
removeAll();
ArrayList<File> list = new ArrayList<>();
for (File file : RECENTS) {
if (file.canRead()) {
list.add(file);
add(new JMenuItem(new OpenDataFileCommand(PathUtils.getLeafName(file.getName(), false), file)));
if (list.size() == MAX_REC... |
635e5928-be00-41a7-a020-ab6b8ab52766 | 3 | public boolean setRegionalGIS(String name) {
if (name == null || name.length() == 0) {
return false;
}
int id = GridSim.getEntityId(name);
if (id == -1) {
return false;
}
gisID_ = id;
return true;
} |
a83277a7-37c3-441b-8ae4-8f99cbdf6766 | 2 | @Override
public boolean extensionExists(String ext) {
Iterator it = getExtensions();
while (it.hasNext()) {
String key = (String) it.next();
if (ext.equals(key)) {
return true;
}
}
return false;
} |
514288c0-6553-4cea-a7f0-bcf763375cfa | 5 | @Override
public void actionPerformed(ActionEvent event) {
if (enLocaleItem.equals(event.getSource())){
Game.getInstance().setLocale(new Locale("en", "US"));
return;
}
if (esLocaleItem.equals(event.getSource())){
Game.getInstance().setLocale(new Locale("es", "ES"));
return;
}
this.remove(basement... |
ec2c23c1-cb40-4051-b271-754282b86e99 | 4 | private static double interpolate(double x, ArrayList<Double> wavSupport, ArrayList<Double> funData ){
double interpValue = 0;
int index = -1;
for(int i = 0; i < wavSupport.size(); i++){
if(wavSupport.get(i) == x)
{
return funData.get(i);
}
else if(wavSupport.get(i) > x)
{
index = i;
... |
d3eff39d-1ef9-4e10-a46e-505ef96f7089 | 8 | private void dialoguerAvecClient() {
String requete = "";
boolean fini = false;
//String req_test;
BufferedReader fluxEntrant = fluxEntrant();
PrintWriter fluxSortant = fluxSortant();
// int num_projet = 0;
/*
* while (num_projet == 0){ try { num_projet =
* Integer.parseInt(fluxEntrant.readLine... |
a830ab80-5f37-4f17-97e8-ef07fe0cd033 | 7 | private void processNode(Element e) throws DOMException, InvalidBLXXMLException {
String nodeName = BLXUtility.getLocalNodeName(e);
if(nodeName.equals(BLX_ALIAS_NODE_NAME) == false) {
throw new InvalidBLXXMLException("Alias Element needs to be named: "+BLX_ALIAS_NODE_NAME);
}
//A... |
0715a4d4-8f4b-4e25-9a47-0875934c92a0 | 6 | @Override
public boolean execute(SimpleTowns plugin, CommandSender sender, String commandLabel, String[] args) {
final Localisation localisation = plugin.getLocalisation();
if (args.length == 0) {
sender.sendMessage(localisation.get(LocalisationEntry.ERR_SPECIFY_TOWN_NAME));
... |
15e42991-747c-43d7-8c49-da95bc3575ff | 3 | protected void startFalling() {
this.startX = getScreen().getScreenX(getObjectX());
this.startY = getScreen().getScreenY(getObjectY());
if (canFall()) {
ensureFalling();
getFacade().fall(getWorm());
if (isObjectStillActive()) {
this.finalX = getScreen().getScreenX(getObjectX());
this.finalY = ge... |
7f33467b-9a84-48ae-8c0d-5ee06c778013 | 7 | public Object getValueAt(int row, int col) {
try {
switch (col) {
case 0 :
return data.getMiscName(row);
case 1 :
return new Double(SBStringUtils.format(data
.getMiscAmount(row), 1));
case 2 :
return data.getMiscUnits(row);
case 3 :
return new Double(data.getMiscCost(r... |
e08043ae-eb02-4f5a-9e0a-454d4ce0fb0b | 5 | private static String compress(String input) {
if (input == null || input.length() <= 2) {
return input;
}
final StringBuffer output = new StringBuffer();
char trackingChar = input.charAt(0);
int charCount = 1;
for (int index = 1; index < input.length(); ++index) {
final char currentChar = input.c... |
f01d0d8e-becb-407f-8217-a236ec7cca9b | 8 | public Tuple2<List<Boolean>,List<Boolean>> checkNumbers(int x, int y){
List<Integer> hnums = picross.left.get(y);
List<Integer> vnums = picross.up.get(x);
List<Tuple2<PixelType, Integer>> hline = shrink(getHLine(y));
List<Tuple2<PixelType, Integer>> vline = shrink(getVLin... |
1eda636e-62bc-427d-9b44-698ab88e5a2d | 2 | private static void insertCode(final FlowGraph cfg,
final SSAConstructionInfo info) {
final Iterator blocks = cfg.nodes().iterator();
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final PhiStmt phi = info.phiAtBlock(block);
if (phi != null) {
Assert.isFalse(phi instanceof ... |
9d57e0bb-7223-40d0-bd60-11085852788a | 1 | public void update() {
if (gameStates[currentState] != null) {
gameStates[currentState].update();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.