method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fcff732c-dc4d-47a8-979e-8042ca8c27de | 8 | public static LinkedList<File[]> recursiveConfigs(File folder) {
LinkedList<File[]> files = new LinkedList<File[]>();
if(folder.exists() && folder.isDirectory()) {
for(File f : folder.listFiles()){
if(f.isFile()){
if(f.getName().endsWith(".pc")) {
files.add(new File[]{f});
}
} else if(f.i... |
665ed986-4d24-4f4e-9dfb-6a8196d8959c | 5 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == y) {
ui.sess.close();
} else if (sender == n) {
ui.destroy(this);
} else if (sender == this) {
if (msg == "close")
ui.destroy(this);
if (msg == "activate"... |
d426db21-7857-467f-a4d3-161b8c414719 | 8 | public static boolean insert(Object bean) {
String sql;
PreparedStatement stmt=null;
try{
if(bean instanceof Patient){
sql = "INSERT into patients ("+Patient.getTableSchema()+") " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt=conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
re... |
b97bd563-938f-4eed-88e4-6be16db802f9 | 8 | @Override
public boolean equals(Object o)
{
try
{
if (!(o instanceof DecodedSource))
return false;
int idx = 0;
while (true)
{
boolean thisHasData = true;
double thisData = 0.0f;
try
{
thisData = getSample(idx);
}
catch (NoMoreDataException e)
{
thisHasD... |
264e9924-6ba9-450f-a06f-b0633ed1973d | 8 | @Override
public void run() {
// Loop until we receive client calls the stop thread method
_isStopped.set(false);
while (!_stopThread.get()) {
try {
// Just burn time in POLL_RATE increments while paused
while (_isPaused.get()) {
... |
71b0eb0e-9241-4509-8d18-6d8a53252a36 | 0 | public void setField(String field) {
this.field = field;
} |
844d0022-1ab0-479c-b940-57e7f760e112 | 9 | public static Node findChildWithAtt(Node parent, String elemName,
String attName, String attVal) {
Node child=DomUtil.getChild(parent, Node.ELEMENT_NODE);
if( attVal== null ) {
while( child!= null &&
( elemName==null || ele... |
ee49fda4-38d3-4ef1-ac32-1e241cd5494e | 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... |
f1bf8910-455d-4459-9724-7dc0971309de | 6 | public void fill(int god, int race) throws IOException{
//Adding God spells
BufferedReader in = new BufferedReader(new FileReader(new File("WarbornData/gods/" + PlayerData.getGodName(god) + ".txt")));
for(String line = in.readLine(); line != null; line = in.readLine()){
for(int i = 0; i < SpellFactory.getNbrOf... |
d7144920-a89f-4488-b2a4-6cf96b582b5c | 6 | public int search(int[] A, int target) {
//find pivot
int pivot = 0;
for (int i = 1; i < A.length; i++) {
if (A[i - 1] > A[i]) {
pivot = i;
break;
}
}
int relativeStart = 0;
int relativeEnd = A.length - 1;
w... |
079d419b-4963-4e11-abad-c8cf6e045b42 | 7 | private void createAdjacent() {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (mines[x][y] == -1) {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
try {
if (mines[x + j][y + i] != -1)
mines[x + j][y + i]++;
} catch (ArrayIndexOu... |
497240f4-d38b-44fa-9933-d28d0c53d6fc | 1 | @Override
public String toString () {
if (isFavoured)
return "(*) " + riverName + " (" + tripFrom + " - " + tripTo + ") " + tripLength + "km WW" + wwLevel;
else
return "( ) " + riverName + " (" + tripFrom + " - " + tripTo + ") " + tripLength + "km WW" + wwLevel;
} |
cdb6d2ed-40dc-48a8-90fa-3beb9efcf4ff | 0 | public synchronized void reset() {
this.choking = true;
this.interesting = false;
this.choked = true;
this.interested = false;
this.exchange = null;
this.requests = null;
this.lastRequestedOffset = 0;
} |
df88328d-b3ea-42e0-9c49-c24515cff1e0 | 5 | public View_Appointments_From_Day_Star(int day, int month) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | View Appointment");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE... |
fbc31d49-83eb-4dbb-a8b9-ef42a034984e | 1 | public int hashCode() {
return (this.getValue() == null) ? 17 : this.getValue().hashCode();
} |
45441407-6e61-4e01-82c5-d639f48077a3 | 1 | public static boolean verifierLoginMdp(EntityManager em, String login, String mdp) throws PersistenceException {
boolean ok=false;
Visiteur unVisiteur = selectOneByLogin(em, login);
Format formatter = new SimpleDateFormat("dd-MMM-yyyy",Locale.ENGLISH);
String dateEmbauche = formatter.fo... |
2bbc48bb-b5b8-4ab9-821f-35cea9e51d9b | 8 | public void updatePlayerMovement(stream str) {
if(dir1 == -1) {
// don't have to update the character position, because the char is just standing
if(updateRequired || chatTextUpdateRequired) {
// tell client there's an update block appended at the end
str.writeBits(1, 1);
str.writeBits(2, 0);
}
... |
376d4604-44d9-4c9c-99ec-ecf05ba3cfcd | 3 | private void parseLandUse() throws FileNotFoundException, InvalidShapeFileException, IOException
{
try (FileInputStream is = new FileInputStream(
"assets/shape/landuse.shp"))
{
ValidationPreferences prefs = new ValidationPreferences();
prefs.setMaxNumberOfPointsPerShape(35529);
ShapeFileReader r = new... |
1874f731-9777-479d-94d4-95712e3f9202 | 9 | public void execute(final MapleClient c, final MessageCallback mc, String[] splitted) throws Exception, IllegalCommandSyntaxException {
MapleCharacter player = c.getPlayer();
if (splitted[0].equalsIgnoreCase("home")) {
if (!SpecialStuff.getInstance().canWarpFrom(player)) {
mc... |
c9abd666-5c23-4bab-913e-fbd140bcb96c | 6 | private Release getLatestRelease(Repository repository) throws IOException {
Release latestRelease = null;
for (Release release : getReleases(repository)) {
if (latestRelease == null || release.getPublishedAt().after(latestRelease.getPublishedAt())) {
latestRelease = release;... |
1211c6bc-12c6-4c35-9d38-62c93380daf3 | 3 | public Node getChildNode(Document doc, Node father, String tagName){
Node childNode = null;
NodeList nodeList = doc.getElementsByTagName(tagName);
if(nodeList.getLength() > 0){
for(int i=0;i<nodeList.getLength();i++){
Node node = nodeList.item(i);
if(node.getParentNode().equals(father)){
childN... |
6823b463-efdf-4f54-8d31-f484b6df314a | 9 | public void writeLocalVariables(int pc, NoteKind kind) {
ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
String indent = space(2); // get from Options?
List<LocalVariableTypeTable_attribute.Entry> entries = pcMap.get(pc);
if (entries != null) {
for (Lis... |
fa20d89b-a7a6-4f6d-b4a4-06dd21b863de | 8 | public void Initialize()
{
try {
FileInputStream fstream = new FileInputStream("graph.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
String str;
... |
76e2cbfb-40ed-427a-9e56-1c430036ecda | 0 | public void setAccountSecret(String accountSecret) {
this.accountSecret = accountSecret;
} |
180b45ea-009c-40e2-8504-1e2d1a423b7c | 8 | public static void calculateImageInsets(int[] argb, int iw, int ih, Insets i) {
for (int x = 0; x < iw && colEmpty(argb, iw, ih, x); x++) i.left++;
for (int x = iw-1; x >= 0 && colEmpty(argb, iw, ih, x); x--) i.right++;
for (int y = 0; y < ih && rowEmpty(argb, iw, ih, y); y++) i.top++;
for (int y = ih-1; y >= 0... |
af6fa0c7-66cb-4167-95d7-7395ca2d14db | 4 | private void findVisualDifferences(int pageNum, PDFPage pagePDF1, PDFPage pagePDF2, File targetFolder)
{
try {
// convert the page in a image
BufferedImage pageImgPDF1 = PDFVisualiseDifference.convertPage(pagePDF1);
BufferedImage pageImgPDF2 = PDFVisualiseDifference.convertPage(pagePDF... |
ca8c87e0-5d60-48a1-b9a7-a5e3fc971641 | 6 | private void quicksort(int low, int high) {
int i = low, j = high;
// Get the pivot element from the middle of the list
T pivot = (T) values.get(low + (high-low)/2);
// Divide into two lists
while (i <= j) {
// If the current value from the left list is larger then the pivot
// element then get the n... |
69a75f66-cd01-449b-9457-70c7ff28c7cf | 7 | public void test(URL aURL) {
String objURL = aURL.toString() + "/object";
// Zero out any pre-existing exception (not thread-safe obviously)
myException = null;
// Run a new test
try {
WebClient webClient = new WebClient();
XmlPage page = webClient.getPage(objURL);
Iterator<DomNode> iterator = page... |
3ef87327-8de1-4ede-9bbb-e44dc274793b | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String ln; (ln = in.readLine().trim()) != null; ) {
String[] arr = ln.split(" +");
if(arr[0].equals("0")&&arr[1].equals("0")&&arr[2].equals("0"))break;
char res[] = new ch... |
eb6fa604-c166-4154-81cb-3f7586cca9bd | 7 | public Archive findStartMatchArchive(String consolFun, long startTime, long resolution) throws IOException {
long arcStep, diff;
int fallBackIndex = 0;
int arcIndex = -1;
long minDiff = Long.MAX_VALUE;
long fallBackDiff = Long.MAX_VALUE;
for (int i = 0; i < archives.leng... |
9c988a62-853f-49e6-b1b8-859c5d12c06d | 2 | public void askQuestions()
{
joinCommunityButton.setVisible(false);
if (correctAnswers >= gameSettings[numQuestionsSettings] && !contributor) {
getPromotedContributor.setVisible(true);
}
gameInfoRow1Label.setText("You need " + gameSettings[numQuestionsSettings] + " points to join the Community!");
... |
f3475795-c643-4be3-8289-a55302bed33f | 5 | public void fadeOut(FilenameURL filenameURL, long milis) {
if (milis < 0) {
errorMessage("Miliseconds may not be negative in method "
+ "'fadeOut'.");
return;
}
fadeOutMilis = milis;
fadeInMilis = 0;
fadeOutGain = 1.0f;
lastFadeCheck = System.currentTimeMillis();
synchronized (sequenceQueueLo... |
00da6fba-a089-4cd9-a10f-de5221c1364c | 7 | public void updateAsScheduled(int numUpdates) {
structure.updateStructure(numUpdates) ;
//
// TODO: Restore this once building/salvage of vehicles is complete.
///if (! structure.intact()) return ;
if (pilot != null && pilot.aboard() == this) {
pilotBonus = 1 ;
if (! pilot.traits.... |
5fee73db-5444-4955-8371-7ae67f352ad6 | 0 | public String getHelloWorld() {
return helloWorld;
} |
86e78ada-2842-47aa-b4f7-f0f60cad56ef | 0 | public int getGraphY() {
return graphY;
} |
77885372-0bda-4ca1-8147-00cd94631948 | 5 | public boolean teleportPlayer(Placeable p) {
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
if (placeable.getType().equals(p.getType()) && placeable != p) {
Player pl... |
909c2201-7b16-41d4-8fd0-4db78d0bcfe2 | 2 | public static long getIdByName(Map<Long, String> qcIdNames,
String qcName)
{
long id = 0;
for (Map.Entry<Long, String> me : qcIdNames.entrySet()) {
if (qcName.equals(me.getValue())) {
id = me.getKey();
break;
}
}
retu... |
f55f9552-33fa-462d-9e2b-e1f04e17d872 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ActualParametersNode other = (ActualParametersNode) obj;
if (list == null) {
if (other.list != null)
return false;
} else if (!list.equa... |
2901f5bf-981b-4257-b55a-5dadc8e9c312 | 3 | public ITDBuilder method( MethodBuilder methodBuilder ) {
if ( methodBuilder == null ) {
return this ;
}
MethodMetadata metadata = methodBuilder.build() ;
for ( MethodMetadataBuilder method : builder.getDeclaredMethods()) {
if ( method.getMethodName().equals( metadata.getMethodName())) {
return thi... |
fc32e3eb-61de-423b-9758-34b1bd1c725b | 2 | public List<String> getListString(String key, List<String> def) {
if(fconfig.contains(key)) {
return fconfig.getStringList(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} |
ba859fb3-fa24-441b-bb7b-4944f8a902b8 | 9 | private static void processAcceptLanguage( String acceptLanguage,
Hashtable languages, Vector q)
{
StringTokenizer languageTokenizer =
new StringTokenizer(acceptLanguage, ",");
while (languageTokenizer.hasMoreTokens()) {
String language = languageTokenizer.nextTok... |
3b521053-2912-4a68-9687-db196b8bfd70 | 7 | public boolean canBearOff(final int playerColor) {
if ( ! legitPlayerColor(playerColor) ) {
throw new IllegalArgumentException("bad player color '" + playerColor + "'");
}
//Here's a quick disqualifier:
if (onBar(playerColor)) {
return false;
}
in... |
7454fbf0-67da-4216-8fab-7d495955cfed | 5 | public static void relative_sort(Integer[] v) {
int firstPositiveIndex = 0;
for (int i = 0; i < v.length; i++) {
if(v[i] < 0) {
if(i != firstPositiveIndex){
int negative = v[i];
for (int j = i - 1; j >= firstPositiveIndex; j--) {
... |
86ebb6c9-00db-4dc2-b8ad-540bdb7a4a03 | 5 | final int method1714(int i, int i_1_) {
anInt5899++;
int i_2_ = ((Class239) this).aClass348_Sub51_3136.method3428
((byte) -104).method1458(i ^ ~0x5c84);
if (i_2_ < 96)
return 3;
if ((i_1_ ^ 0xffffffff) < -2 && i_2_ < 128)
return 3;
if (i_1_ > i && (i_2_ ^ 0xffffffff) > -193)
return 3;
retu... |
5cde6124-736e-4993-9178-ed6c111b6450 | 9 | @Override
public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) throws HantoException {
MoveResult result = null;
if(currentTurn.equals(HantoPlayerColor.BLUE)) {
if(pieceType.equals(HantoPieceType.BUTTERFLY) &&
from == null && to.getX() == 0 && to.getY() == 0)... |
b7f74aed-ad65-4445-aa68-76fec1751dd9 | 3 | public void newLevel(final boolean newlevel) {
if (newlevel)
level++;
if (level == 7)
levelType = LEVEL_MID;
if (level == 12)
levelType = LEVEL_COMPLEX;
world = new World(level);
player = new PlayerEntity(new Vector2d(30, Canvas.HEIGHT - 150));
titelTimeleft = MAX_TITEL;
levelFinished = false;... |
f0eb402c-ec88-4d33-b0f2-59f0aa23c111 | 8 | public double minETCost() {
sortResources();
sortClass();
calculateWeight();
dmMinminCost = new double[iSite][iCPUMaxNum];
dmMinminTime = new double[iSite][iCPUMaxNum];
double[] daMinminTimeBySite = new double[iSite];
// find the current cheapest site for the acitvities.
while (getRestLength() > 0) {... |
c84b54c9-be3c-4f55-8f52-cf72a1338039 | 9 | @Override
public void run() {
this.running = true;
while (this.running) {
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
//Thread.yield();
}
} |
591c3b86-8c30-4ef1-978b-e52fe76f70af | 9 | public boolean connected(int s, int lo, int hi) {
if (connected == null) connected = new boolean[N];
Arrays.fill(connected, false);
boolean[] localConnected = new boolean[hi-lo];
int lConnN = 0; // number of local connections
ArrayDeq... |
c616a2cb-2bd5-4390-8a84-01d32b818a05 | 4 | private void testRecover(){
String env = this.reader.getENV();
List<String> recoverStatusList = new ArrayList<String>();
String status;
if(env.equalsIgnoreCase("DEV")){
this.recoverURL = reader.getRecoverURLFromConfigDEV();
try {
long recoverStartTime = System.currentTimeMillis();
BaseReader reade... |
f4f36f3c-836c-4ebe-83e9-7a75316b68e6 | 3 | private void rungeKutta(double h) {
Vector3D[] kv1 = new Vector3D[bodies.size()];
Vector3D[] kr1 = new Vector3D[bodies.size()];
Vector3D[] kv2 = new Vector3D[bodies.size()];
Vector3D[] kr2 = new Vector3D[bodies.size()];
Vector3D[] kv3 = new Vector3D[bodies.size()];
Vector3D[] kr3 = new Vector3D[bodies.size(... |
c030461c-d9bb-4b20-9595-bbb9690b8858 | 0 | private IautosSellerType(int code) {
this.code = code;
} |
f57cec7a-99f5-4961-af35-2bc489d0ffd6 | 7 | @Override
public List<TipoServico> Buscar(TipoServico obj) {
String consulta = "select ts from TipoServico ts";
String filtro = "";
HashMap<String, Object> parametros = new HashMap<String, Object>();
if (obj != null) {
if (obj.getIdTipoServic... |
03510d2c-44d5-46b2-9e3b-ebbde1601976 | 0 | public void setSymmetricAlgo(AlgoCryptType algo) {
this.symmAlgo = algo;
} |
6131e969-1528-4a39-b277-483e7ee18d6f | 4 | private List<Mapper> estimateMappers() {
List<Mapper> newMapperList = new ArrayList<Mapper>();
List<Long> splitsSizeList = splitMap.get((int)(newConf.getSplitSize() / 1024 /1024));
MapperEstimator mapperEstimator = new MapperEstimator(finishedConf, newConf);
//split size is changed
if(isSplitSizeChanged... |
d6c3e84f-3949-4899-9a83-cce4fb7d1ade | 5 | public boolean searchAl(ArrayList<Item> al,int val) {
boolean rtrn = false;
int checkValue = -1;
int lowersub = 0;
int uppersub = al.size()-1;
int midsub = (lowersub + uppersub)/2;
while (lowersub < uppersub && rtrn !=true) {
if (al.get(midsub).data2>val) {
uppersub=midsub-1;
} else if (al.... |
36a0ee1e-633b-4ed8-9b91-f3147b04e9fc | 0 | @Override
public String toString() {
return format("CacheKey (service=%s, lastModified=%s)", service, lastModified);
} |
105c468e-897a-46a2-902c-7075a79fc384 | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
f90dd6b4-10be-458d-9078-b42e24355367 | 0 | public String getName() {
return name;
} |
a4425cf6-77fd-4af3-bb94-8d108b0f10e7 | 3 | public boolean getPermissions(final int permissionIndex) {
if (!isInit) {
init();
}
// return false if the permission index is out of bounds.
return !(permissionIndex < 0 || permissionIndex > permissions.length)
&& permissions[permissionIndex];
} |
f5137ee4-8761-4253-8aef-4aa93164271f | 5 | public void addShapesTo(List<SGObject> nextFrame) {
nextFrame.addAll(background);
if (cards.size() == 0) {
return;
}
int xOff = 0;
if (cards.size() != 1) {
xOff = Math.min((width-CARD_WIDTH-2*MED_GAP)/(cards.size()-1), CARD_WIDTH+MED_GAP);
}
int handWidth = (cards.size()-1)*xOff+CARD_WIDTH;
int x ... |
e6d7869a-aad3-454e-b2b9-536a63fd95bf | 6 | public void clear() {
if (ava != null)
ui.destroy(ava);
ava = null;
if (rmb != null)
ui.destroy(rmb);
if (invb != null)
ui.destroy(invb);
if (chatb != null)
ui.destroy(chatb);
if (name... |
dfc901ea-2cdc-46ed-9458-3ff7fa381fe4 | 1 | public static DataModule getDataModule(String context) {
try {
return CONTEXT_CACHE_MODULE.get(new ContextKey(context, DataModule.class),
() -> new GenericDataModule(context));
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
} |
6d90b7a8-906c-4820-a935-941f0b882d7b | 4 | public void entrenar(String[][] entradas){
boolean finalizado = false, primeraEpoca = true;
int y = 0;
double error = 0, errorCuadraticoMedio = 0, valorActivacion = 0;
this.numeroEpocasFinal = 0;
this.errores.clear();
while(!finalizado){
for(int n = 0; n < entradas.length; n++){
... |
66786445-d6e8-4cad-a78b-79287ee07634 | 7 | private void parseComments(Document doc) throws IOException {
CommentInfo currentComment;
Elements comments = doc.select("div[class~=(comment|comment comment-by-node-author) clearfix]");
for (Element src : comments) {
currentComment = new CommentInfo();
Element number = src.select("a[class=permalink]").fir... |
daa44a23-9374-4470-a313-55ce28eab8f2 | 0 | public InvalidRunSizeException(Exception e, String name)
{
super(e, name);
} |
3407148d-8e12-47aa-b093-697dec6b9d2b | 7 | public void computeBoundingBox() {
// TODO: Compute the bounding box and store the result in
// averagePosition, minBound, and maxBound.
// Hint: The bounding box may be transformed by a transformation matrix.
Point3 p1,p2,p3,p4,p5,p6,p7,p8;
p1 = new Point3(center.x-radius,center.y-radius,center.z-he... |
b9b3f424-ca7c-4694-8faa-9f719ba79a24 | 0 | public void save() throws SQLException {
Map<String,String> values = new HashMap<String,String>();
values.put("name", this.name);
values.put("capacity", String.valueOf(this.capacity));
this.save(values);
this.saveArray("aWaitingId", this.aWaitingId);
} |
294955af-6c7b-4b75-a6d1-32382b707d84 | 3 | public static void toggleMoveableAndClear(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
toggleMoveab... |
a9e2dca1-8e43-469a-95f4-9f66b5ace971 | 3 | public static BufferedImage combine(BufferedImage layer, Iterable<Circle> circles)
{
BufferedImage image = new BufferedImage(layer.getWidth(), layer.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
Graphics2D g = (Graphics2D)image.getGraphics();
g.drawImage(layer, 0, 0, null);
g.setFont(... |
9b10ec64-6a0c-45c0-a7a0-4787caba8482 | 7 | public ArrayList<CheckOut> getOverdueCO(int numDays) throws Exception{
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
ArrayList<CheckOut> overdueCOList = new ArrayList<CheckOut>();
try {
// First connect to the database
connect = DriverManager.getConnecti... |
ec8e431f-7c45-4a28-b6c4-64be5ea50886 | 5 | @Override
public void execute() {
Paint.status = "Finding a giant";
theGiant = getMonster();
if(theGiant != null){
Global.deathLocation = theGiant.getLocation();
Paint.status = "Fighting giant";
if(Methods.isOnScreen(theGiant) && !theGiant.isInCombat() &&... |
0b46a103-5d22-4078-a3d1-61c5eeee914f | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
System.out.println("Error en " + e.toString());
... |
c68181c0-1654-4fdc-9564-76f7a0c315da | 2 | public FrmListaLogros(Logro[] logros, FrmPrincipal fp, Eventos eventos) {
this.fp =fp;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 250, 400);
setUndecorated(true);
setIconImage(new ImageIcon(FrmPrincipal.class.getResource("/Imagenes/icono.png")).getImage());
getRootPane().setWindowDe... |
2394582e-f58f-4eeb-ab51-5ed2d0052fb6 | 3 | public static String getCorrectPinFromUser() {
String password = "";
try {
do {
Console c = System.console();
char[] passwordarray = c.readPassword("Password: ");
password = String.valueOf(passwordarray);
if (!password.matches("... |
3db47c68-8f0b-49fb-869c-4aebed8ab982 | 7 | private static void addFiles(File file, List<String> result, File reference) {
if (!file.exists() || !file.isDirectory()) {
return;
}
for (File child : file.listFiles()) {
if (child.isDirectory()) {
addFiles(child, result, reference);
} else {
String path = null;
while (child != null && !chil... |
97aff925-15d7-43eb-b16b-371584f29344 | 9 | public Node[] checkRandomNode(Node rnode, int hid)
{
int slen, dlen;
slen = (snodes[spos] == null ? spos : snodes.length);
if (slen == 0)
return null;
int k = CommonState.r.nextInt(slen);
Node random1 = snodes[k];
HistoryUndirected history1 = (HistoryUndirected) random1.getProtocol(hid);
slen = (history1.snode... |
b571922a-167a-480b-b246-17b0f6a2e8a4 | 4 | public List<CategoriaDTO> entityToDTOList(List<Categoria> categorias, Produto produto) {
List<CategoriaDTO> categoriasDTO = new ArrayList<>();
for (Categoria categoria: categorias){
boolean isSelected = false;
if (produto != null && produto.getCategorias() != null && produto.getCategorias().contains(categ... |
f7ace786-f355-439a-a04f-f36cda8aac48 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidadElementos()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
b0d4ae73-2d14-4e91-9ed6-c5ccd0e962b3 | 8 | public java.io.File generateHlsPlaylistFileWithCorrectPaths(File segmentFile) {
if (!creatingDashAndHlsRenders) {
return null;
}
java.io.File destinationPlaylistFile = new java.io.File(FileHelper.format(outputFile.getParentFile().getAbsolutePath()+"/"+outputFile.getName()+"_hls_updated.mpd"));
java.io.F... |
14ae0087-e447-4756-8ea6-e8e48f3f692a | 3 | @Override
boolean isPerpendicularAttackPlacementNotHarming(int position, int dimension, char[] boardElements) {
return isAttackPlaceHorizontallyRightNotHarming(position, boardElements, dimension, KING_NEIGHBOUR_POSITION)
&& isAttackPlaceHorizontallyLeftNotHarming(position, boardElements, dim... |
3c9f48d9-ed90-4c9b-93a2-9b54044b9b7c | 5 | public void doColorize( BufferedImage image )
{
int height = image.getHeight();
int width;
while( height-- != 0 )
{
width = image.getWidth();
while( width-- != 0 )
{
Color color = new Color( image.getRGB( width, height ) );
int lum = lum_red_lookup [color.getRed ()] +
lum_gr... |
a421c8a6-1812-427a-919f-b7370dd4d688 | 0 | public void paint(Graphics g, int x, int y){
g.setColor(this.color);
g.fillRect(x, y, BLOCK_SIZE, BLOCK_SIZE);
} |
04440937-54b3-436d-86d8-2385a1e91e7e | 2 | private static void printFile(final String resource, final PrintStream out)
{
try {
final InputStream in = Genetic.class.getResourceAsStream(resource);
int readByte;
while ((readByte = in.read()) != -1) {
out.write(readByte);
}
i... |
ca002284-f3f4-48f2-9cd6-b05f72ee344c | 5 | public void render(Graphics graphics) {
synchronized (objects) {
objects.removeAll(deadObjects);
Location cameraLocation = descent.getLevelPanel().getCamera().getLocation();
for (LevelObject object : objects) {
if (!(object instanceof Player)) {
... |
3c381dff-ea5f-4fb1-9602-9151fe0d5f85 | 4 | public double getDouble(String key) throws JSONException {
Object o = get(key);
if(o==null) return 0;
try {
if(o instanceof Number){
return ((Number)o).doubleValue();
}else if(o.toString().length()>0){
return Double.valueOf((o.toString()));
}else
... |
7de75a82-bd46-46ab-a7f8-32343ebbfad2 | 4 | @Override
public void deserialize(Buffer buf) {
questId = buf.readUShort();
if (questId < 0 || questId > 65535)
throw new RuntimeException("Forbidden value on questId = " + questId + ", it doesn't respect the following condition : questId < 0 || questId > 65535");
stepId = buf.re... |
7cfab735-21e0-4cb4-adfa-4653f69b68d9 | 7 | public Component getComponentForDataSection(TaskObserver taskObserver, String dataSectionName) throws InterruptedException
{
if ( (GameVersion.MM6 == outdoorDataMap.getGameVersion())
&& (dataSectionName == DATA_SECTION_TERRAIN_NORMAL_DATA) ) return getNonApplicablePanel(taskObserver);
... |
ab7811ac-ea68-4441-8067-e7ba02070bbf | 6 | public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
double[][] equations = new double[3][4];
for(int i = 0; i<3; i++){
for(int j = 0; j<4; j++){
try {
equations[i][j] = Double.parseDouble(reader.readLine... |
47848619-1c28-470c-a495-dffa5cc13e26 | 8 | protected Hyphen(final String libDir) throws UnsatisfiedLinkError,
UnsupportedOperationException {
libFile = libDir != null ? libDir + "/" + libName() : libNameBare();
try {
hunspellLibrary = (HyphenLibrary) Native.loadLibrary(libFile,
HyphenLibrary.class);
} catch (UnsatisfiedLinkError urgh) {
//... |
9b5e763d-7659-41e3-bb60-fbfa68260294 | 5 | public boolean isInAnyPlayingState() {
return (status.equals("FirstRound") ||
status.equals("SecondRound") ||
status.equals("Rolling") ||
status.equals("Playing") ||
status.equals("Discarding") ||
status.equals("Robbing"));
} |
11fae0fd-8a06-476a-9951-bf11b9a36881 | 2 | private Object[] readClosedList() throws IOException {
ArrayList objects = new ArrayList();
while (true) {
int code = readNextCode();
if (code == Codes.END_COLLECTION) {
return objects.toArray();
}
objects.add(read(code));
}
} |
ff8bb434-0ae7-4b70-9e5e-b90e06c8d53c | 1 | private void resume() {
this.remove(resumeButton);
this.add(gameGrid);
this.add(holdGrid);
for (int i = 0; i < QUEUE_SIZE; ++i) {
this.add(inQueueGrid[i]);
}
MainFrame.getThis().requestFocus();
repaintGrid();
paused = false;
fallTimer.start();
} |
f778fda1-a21b-4dd1-9171-37b8acf78919 | 5 | @Override
public int indexOf(Object o) {
if (o == null) {
for (int i = 0; i < size; i++) {
if (data[i] == null) {
return i;
}
}
} else {
for (int i = 0; i < size; i++) {
if (o.equals(data[i])) {
... |
11abd21b-0aba-4b48-bf27-5e60620442c1 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
67a1e55e-d0b5-488b-8baa-e4fe31f6ac2a | 0 | private static int getShortBigEndian(byte[] a, int offs) {
return
(a[offs] & 0xff) << 8 |
(a[offs + 1] & 0xff);
} |
d7dd5cb2-8d6a-4e88-babc-af0ff558c155 | 9 | private void formatDecimal(BigDecimal dval, FastStringBuffer fsb) {
dval = dval.setScale(maxFractionPartSize, BigDecimal.ROUND_HALF_EVEN);
DecimalValue.decimalToString(dval, fsb);
int point = fsb.indexOf('.');
int intDigits;
if (point >= 0) {
... |
8e1b52bf-3c1f-4ba4-8bcc-7e584a8680d0 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[41];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 4; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
efac8cfb-43bd-4c60-b953-b2dc1fc7c0c0 | 4 | public int compareTo(Object other)
{
Location otherLoc = (Location) other;
if (getRow() < otherLoc.getRow())
return -1;
if (getRow() > otherLoc.getRow())
return 1;
if (getCol() < otherLoc.getCol())
return -1;
if (getCol() > otherLoc.getCol(... |
4281dbd2-a3b3-4962-b42e-ae97320bb091 | 0 | private void layoutThisFrame(){
/*JFrame Editing*/
setTitle("Hunt the Wumpus!");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(800, 600);
setLocation(200, 100);
setLayout(null);
/*JTabbedPane editing*/
viewContainer.setSize(550, 550);
viewContainer.setLocation(200, 0);
viewContainer.a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.