method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
063cbfec-b494-41a7-bfa0-c59a505e859e | 3 | public <T extends Component> T getComponent(UUID entity,
Class<T> componentType) {
synchronized (componentStores) {
HashMap<UUID, ? extends Component> store = componentStores
.get(componentType);
if (store == null) {
throw new IllegalArgum... |
450183c8-9415-458d-bdd3-4c104ae4c41d | 7 | public static String getHtml(String urlString) {
try {
StringBuffer html = new StringBuffer();
java.net.URL url = new java.net.URL(urlString); //根据 String 表示形式创建 URL 对象。
java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection();// 返回一个 URLConnection 对象,它表示到 URL 所引用的远程... |
27753dcb-dbb0-438f-b317-e0b410e78a42 | 8 | private Element createLanguages() throws ProfilerException {
Element languages = doc.createElement("languages");
/* Check if at least two langauages were inputed */
if (request.getParameter("stlanguage") != null && !request.getParameter("stlanguage").isEmpty()) {
languages.appendChi... |
d12c7823-1aca-4f8e-b430-18ed8f8b34e5 | 3 | private void notifyAllUserGone(ManageClientArgument mcArg) {
this.log.info("notify All User Gone");
if (this.chatServer.manageClients(ClientCommand.BYE, mcArg)) {
Object[] sockets = mcArg.clientsSocket.toArray();
for (int i = 0; i < sockets.length; i++) {
try {
PrintStream serverResponses = new Print... |
632907cc-a29f-4103-a3a6-0e71f36cf334 | 4 | @Async
public void getUpdate(int ticket, String id, DeferredResult<String> result) {
try {
while (!result.isSetOrExpired()) {
synchronized (result) {
String content = pomDao.getAllNextLines(ticket);
if (content != null) {
if (content.contains(END_SYMBOL)) {
endScan(ticket);
}
... |
9db3671e-4c41-4395-9a3e-984d1bbe1cff | 7 | public void mainMenu() {
ArrayList<CV> CVList = new ArrayList<CV>();
CVManagerImplementation cvman = new CVManagerImplementation();
while (true) {
System.out.println("Do you want to enter a CV? Yes or No?");
char answer = takeUserInput().charAt(0);
if (answer... |
5015cee1-577f-4d56-9ddd-3bad2bc57045 | 9 | private void collideFireballAndPlayer(Fireball f, Player p, int delta) {
double ballWidth,ballCenterX,shieldWidth,shieldCenterX;
if(p.getCurrentFacing() == FACING.UP || p.getCurrentFacing() == FACING.DOWN) {
// get fireball colbox width
ballWidth = f.getCollisionRect().getWidth();
// get the center of t... |
64f40a4d-ade6-4009-9ff6-4e7aa0b46cf7 | 6 | private int partition(int[] input, int lo, int hi) {
int left = lo;
int right = hi + 1;
while (true) {
while (input[++left] < input[lo]) {
if (left == hi) break;
}
while (input[--right] > input[lo]) {
if (right == lo) break;
... |
339962ca-2a38-44d1-9fc1-8d831c062a1f | 1 | public static void main(String args[])throws Exception {
MulticastSocket server =new MulticastSocket(1234);
InetAddress group = InetAddress.getByName("234.5.6.7");//getByName- returns IP address of given host
server.joinGroup(group);
boolean infinite = true;
/* Continually receives data and prints them ... |
d8aac1cc-d88e-4cad-857e-67ac7ef07674 | 4 | public int _delValue(int key, String valueName) throws RegistryErrorException
{
try
{
Integer ret = (Integer)delValue.invoke(null, new Object[] {new Integer(key), getString(valueName)});
if(ret != null)
return ret.intValue();
else
return -1;
}
catch (InvocationTargetE... |
83bd3d7a-70e0-46ba-9226-37e844f9509f | 5 | public BountyWorldConfig(FileConfiguration cfg, String folder)
{
ConfigurationSection sect;
/* ################ UseWorldSettings ################ */
if (folder.length() != 0)
{
useWorldSettings = cfg.getBoolean("UseWorldSettings", false);
set(cfg, "UseWorldSettings", useWorldSettings);
}
else
{
... |
cd5c4047-c4c7-44f8-9114-423d70be3d81 | 5 | int mediumMakeAmove(Board b)
{
int cell = -1;
// We first check whether the CPU can win
cell = b.isAbleToWin(symbol);
// We then check whether the opponant can win
if(cell == -1)
cell = b.isAbleToWin('X'); // Need to fix hardcoding here
// Pick the middle cell if it's unoccupied
if(!b.isOccupied(4) ... |
395876b4-1389-4777-9110-4b0ee883ecd4 | 3 | public ArrayList<Empleado> resultQueryType(String sql){
ArrayList<Empleado> nacList = new ArrayList<Empleado>();
try {
rs = stm.executeQuery(sql);
try {
while(rs.next()){
Empleado item = new Empleado(rs.getInt("idtipoEmpleado"),
rs.getString("tipoEmpleado"));
nacList.add(item);
... |
e97c7891-ea52-4704-bc9f-f20d4f4a0904 | 1 | public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
if (mv != null) {
mv.visitLookupSwitchInsn(dflt, keys, labels);
}
execute(Opcodes.LOOKUPSWITCH, 0, null);
this.locals = null;
this.stack = null;
} |
57f49ce9-3735-4a49-b629-5b2be39cfa5a | 4 | private static void parseLine(String l){
System.out.println("\t" + l);
String obj;
if(l.contains("::=")){
obj = l.substring(0, l.indexOf("::=")).replace(" ", "");
Config.labels.add(obj);
Config.hash.put(obj, new ArrayList<Composant>());
l = l.substring(l.indexOf("::=")+3);
String[] split = l.split(... |
73a49e5f-4f52-4f7e-9c94-78baf8c7b38f | 2 | public int getLastId(String col, String table) {
String lastIdQuery = "SELECT MAX(" + col + ") AS ID FROM " + table;
int lastId = 0;
try {
rs = stmt.executeQuery(lastIdQuery);
if (rs.next()) {
lastId = rs.getInt("id");
}
} catch (SQLException e) {
System.out.println("Cannot get the last id from ... |
572776e2-5231-4eb1-acc6-403f2c8c63af | 2 | public void resetShadow()
{
for (int r=0; r<rows; ++r) {
for (int c=0; c<cols; ++c) {
grid.getImageStack(r, c).widgetAtLayer(5).show();
}
}
} |
318795ef-df86-4366-8607-9c5afb646e84 | 2 | public boolean hasSafe() {
boolean answer = false;
for (int i = 0; i < this.computers.length; i++) {
if (!this.computers[i].isInfected()) {
return true;
}
}
return answer;
} |
513c8e2d-d506-4c9d-bb04-094772ff989b | 6 | public void replaceSource(FreeColGameObjectType oldSource,
FreeColGameObjectType newSource) {
for (Ability ability : getAbilities(this)) {
if (oldSource == null || ability.getSource() == oldSource) {
removeAbility(this, ability);
Ability ... |
44a7d40f-94e8-4444-85f3-6dd126e54ad6 | 8 | public static void main(String[] args) throws FileNotFoundException {
short player1Wins = 0, i = 0, line = 0, h1Wins = 0;
Hand h1 = new Hand(), h2 = new Hand();
Scanner poker = new Scanner(new File("poker.txt"));
//mixed logic; set new hands and compare them at the same time
whil... |
cedc908e-78a6-435b-a1ea-bf6c9716c786 | 1 | private static long selfP(int n){
long sum = 1;
for(int i=0;i<n;i++){
sum = (sum*n)%(10000000000L);
}
return sum;
} |
de6acc79-e64f-4b45-bb1c-740fb78ba8bb | 3 | public static ArrayList<Models.DatabaseModel.Bill> findUserAllBill(int patientId) {
String query = "SELECT `bill`.`billId`, "
+ " `bill`.`patientId`, "
+ " `bill`.`dateCreated`, "
+ " `bill`.`datePaid`, "
+ " `bill`.`consultationCos... |
1542988d-cf45-4591-8df5-6a2eb55d716f | 8 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MarkerAxisBand)) {
return false;
}
MarkerAxisBand that = (MarkerAxisBand) obj;
if (this.topOuterGap != that.topOuterGap) {
return f... |
0e4d511f-ded6-465e-94f9-b2931a65ef20 | 5 | public static void compressFile(String inputFile, String output){
////Setup////
readCharacters(inputFile);//Get every character in the file
generateFrequency();//Generate a frequency map and get every unique character
buildTrie();//Build the trie and generate a translation map
//Create Header
ByteBuffer he... |
3b98baad-0f40-4f1f-a76b-472acab0a17f | 4 | private void emissionVersServeur() {
boolean fini = false;
String requete = "";
String reponse = "";
int projet = 0;
PrintWriter fluxSortant = fluxSortant();
BufferedReader fluxEntrant = fluxEntrant();
/*
* while (projet == 0){ projet = Outils.lireEntier("N° du projet : ");
*
* fluxSortant.prin... |
d057b348-d1d4-4e32-ad8b-a111cc06b7d0 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO,
"[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfiguratio... |
cbb68693-7369-4304-98cd-4828cb78e4ce | 4 | public void draw(Graphics graphics) {
DynamicArray<Edge> drawnEdges = new DynamicArray();
DynamicArray<Edge> edges = graph.getEdges();
for (int i = 0; i < edges.getSize(); i++) {
if (!drawnEdges.contains(edges.get(i)) || !drawnEdges.contains(Edge.reverse(edges.get(i)))) {
... |
0f9e1c68-9b1f-441a-b991-f4595ccd7245 | 9 | @Override
public void mousePressed(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
b8951647-50ca-4fc1-8f4e-be51fdd3566a | 4 | public double[] computeFFTReal(double[] dataReal) {
if (dataReal == null) {
return null;
}
/* compute the next power of two */
double dnn = Math.log((double) dataReal.length) / Math.log(2.0);
int log2nn = (int) Math.ceil(dnn);
int fftLength = (int) Math.pow(... |
db96ae46-9f8d-4b12-9305-c0ecc0b99890 | 2 | public synchronized void muxpkt(HTSMsg msg, int clientId){
Subscription s = getSubscription((Long) msg.get("subscriptionId"), clientId);
HTSPServerConnection c = monitor.getServerConnection(s.serverConnectionId);
msg.put("subscriptionId", s.serverSubscriptionId);
try {
c.send(msg);
} catch (IOException e) ... |
57d56081-0619-41f7-88d2-674db4730fe7 | 4 | private void addRightClickItems(final TableViewer tableViewer){
// create menu item to delete column
final Menu tableHeaderMenu = new Menu(tableViewer.getTable());
// create menu item to insert column
final MenuItem insertColumnItem = new MenuItem(tableHeaderMenu,
SWT.PUSH);
insertColumnItem.setText... |
c6103ab9-c05e-4b05-8679-2dbe9f1df391 | 5 | public String commitAndPushToFreenet(PrintStream out) throws IOException {
FileManifest.Changes changes = mFileManifest.diffTo(mArchive, mOverlay);
if (changes.isUnmodified()) {
throw new IOException("Didn't find any local changes to submit.");
}
// Copy so that we can clean... |
0a166389-1401-494d-8f5b-9ca470ac1f60 | 0 | public CheckResultMessage checkTotal2(int i){
return checkReport1.checkTotal2(i);
} |
ab422537-06ab-4936-a85e-49f1a5ad869b | 2 | public boolean existSubForum(String forumId, String subForumid) {
for (int i = 0; i < forums.size(); i++) {
if (forums.get(i).getId().equals(forumId))
return forums.get(i).existSubForum(subForumid);
}
return false;
} |
f27501fc-02a5-4ce6-9521-6b572c8d7db7 | 8 | public void main(){
Scanner s = new Scanner(System.in);
PiggyBank pb = new PiggyBank();
boolean cont = true;
while (cont){
System.out.println("1. Show total in bank.");
System.out.println("2. Add a penny.");
System.out.println("3. Add a nickel.");
... |
8b6e53d9-5211-4482-8cec-5f6f426338f2 | 5 | public NStarParametperPort(OperatorDescription description) {
super(description);
addObserver(new Observer<Operator>() {
@Override
public void update(Observable<Operator> observable, Operator op) {
if(op!=null)
if(op.getInputPorts()!=null){
int ports=op.getInputPorts().getNumberOfPorts();
... |
953d9cb0-68dc-49c0-9697-c280e0547675 | 1 | private void loadCourse(Course course) {
// Clear scorecard
clearScorecard();
// Add par values to scorecard
for (int holeNumber = 0; holeNumber < course.getNumberOfHoles(); holeNumber++) {
Hole hole = course.getHole(holeNumber + 1); // +1 to match human #
tblScor... |
07742c1e-6bf7-4b1e-b83a-aed9a3f3612f | 7 | public static Element getFromChar(char c) {
switch (Character.toUpperCase(c)) {
case 'F':
return FIRE;
case 'I':
return ICE;
case 'L':
return LIGHTING;
case 'S':
return POISON;
case 'H':
return HOLY;
case 'P':
return PHYSICAL;
case 'D': // Added on v.92 MSEA
return DARK... |
26e2a18e-d920-42ac-8cbc-8ea8bbc8753c | 4 | public int getMatchLen(int index, int distance, int limit) {
if (_streamEndWasReached) {
if ((_pos + index) + limit > _streamPos) {
limit = _streamPos - (_pos + index);
}
}
distance++;
// Byte *pby = _buffer + (size_t)_pos + index;
int pby ... |
24851352-c6db-411e-b79c-5eabbd46bf61 | 0 | public int getProgress() {return bar.getValue();} |
44c74840-73b2-4e60-8951-5c2eb5553ffc | 3 | private boolean isPageStateDirty() {
return currentZoom != documentViewModel.getViewZoom() ||
currentRotation != documentViewModel.getViewRotation()
|| oldClipBounds.width != clipBounds.width
|| oldClipBounds.height != clipBounds.height
;
} |
5d7c1098-f71a-46e5-9610-f656d2655e9b | 0 | public int getThreshold() {
return this.t;
} |
efba32c7-6a80-40d0-b4d6-aeaee6563a8d | 2 | public double[] rowMeans(){
double[] means = new double[this.numberOfRows];
for(int i=0; i<this.numberOfRows; i++){
means[i] = 0.0;
for(int j=0; j<this.numberOfColumns; j++){
means[i] += this.matrix[i][j];
}
mean... |
95dc1455-57ec-479e-b7e4-2c5dc13397f5 | 1 | public TransitionWindow(FSAToREController controller) {
super("Transitions");
this.controller = controller;
// Init the GUI.
setSize(250, 400);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(
new JLabel("Select to see what transitions were combined."),
BorderLayout.NORTH);
ge... |
360053aa-314a-4677-a2b8-543ba9354e41 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setText("jLabel1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
... |
8b0369b3-e90c-4f59-8bdd-3b605261d965 | 4 | protected void slice_check()
{
if (bra < 0 ||
bra > ket ||
ket > limit ||
limit > current.length()) // this line could be removed
{
System.err.println("faulty slice operation");
// FIXME: report error somehow.
/*
fprintf(stderr, "faulty slice operation:\n");
debug(z, -1, 0);
... |
bd65a9a0-7d3e-4519-9de7-2c8c44350fcb | 0 | @After
public void tearDown() {
} |
b42b3098-f58c-48fc-816f-81b591fe0161 | 8 | protected boolean changeRoomAir(Room R, Room notifyRoom, int atmoResource)
{
if(R==null)
return false;
if(R.getAtmosphere()!=atmoResource)
{
if(atmoResource==0)
{
R.showHappens(CMMsg.MSG_OK_ACTION, L("@x1 rushes out of the room.",RawMaterial.CODES.NAME(R.getAtmosphere()).toLowerCase()));
if((not... |
44e5932b-304e-41f6-8736-12b4903a846e | 1 | public void copyFiles(Path from, Path to, ArrayList<Path> files) throws IOException{
for(Path path : files){
Path sourcePath = from.resolve(path);
Path targetPath = to.resolve(path);
Files.createDirectories(targetPath.getParent());
Files.copy(sourcePath, targetPath);
logger.debug("cp "+sourcePath+" "+t... |
788eef73-4907-486d-9c71-582586a74270 | 6 | public boolean saveAsHumanReadable(String filename) throws Exception {
if (null == filename) {
throw new Exception("Filename must not be null");
}
if (values == null) {
return false;
}
// open the streams and send the height data to the file.
try {
FileWriter o = new FileWriter(filename);
f... |
2b54668f-75d8-4def-98b8-ea1beca50a5a | 2 | public static boolean isNavigatorEditingbutton(String name){
for (NavigatorEditingButton neb : NavigatorEditingButton.values()){
if (neb.toString().equals(name)){
return true;
}
}
return false;
} |
d184b5b0-e323-4651-bebb-6355467facab | 9 | public void windowClosing(WindowEvent e) {
{
if (!savePending) {
OpeningFrame.this.dispose();
return;
}
int choice = JOptionPane.showConfirmDialog(OpeningFrame.this, "Save the current screen before exit?");
if (choice == JOptionP... |
8514324f-6593-42cc-ad52-37102cc95d30 | 5 | private void merge(char[] arr, char[] helper, int front, int mid, int rear) {
// copy the original arr to helper arr
// we need to do that,since every merge is actually modifying arr,
// helper is just used to compare, it didn't change
// so next merge we must update the helper first, which seems
// ineffici... |
8345ec33-f3ec-47ad-bc41-43df9eced2c2 | 4 | @Override
public void caretUpdate(CaretEvent event) {
// we need to store and remove the specific highlight that
// we created. If we remove all the highlights, that affects
// or ability to manually highlight code
if (pairHighlightTag != null) {
highlighter.removeHighlight(pairHighlightTag);
pairHighlig... |
4c9d1122-c4a0-4418-b11d-e50f94e63d58 | 1 | @Override
public void use(Player player, Direction direction) throws InvalidActionException {
if (!moveable(direction))
throw new IllegalArgumentException("The item can't be used in the given direction!");
useItemOnPlayersPosition(player);
move(direction);
} |
245996ef-abdf-4b30-9fa6-b7367b609446 | 4 | public static WrappedDataWatcher createDefaultWatcher(FakeMob mob) {
WrappedDataWatcher data = new WrappedDataWatcher();
addEntityDefaults(data, mob.getType());
//Custom Name:
if (mob.getCustomName() != null && !mob.getCustomName().isEmpty()) {
data.setObject(11, (byte) 1);
data.setObject(3, (byte) 1);
... |
9c5ba50e-8bc9-4b18-897a-343c58e22682 | 2 | public static State getStateForVariable(String variable,
VariableDependencyGraph graph) {
State[] states = graph.getStates();
for (int k = 0; k < states.length; k++) {
State state = states[k];
if (state.getName().equals(variable))
return state;
}
return null;
} |
7ee0a4ff-d5f9-47c9-a686-f7a8660fe8f2 | 6 | private void constructBTree() throws FileNotFoundException{
try {
int linesRead = 0;
long postlenghtCounter = 0;
BufferedReader br = new BufferedReader(new FileReader(IndexFileUtils.getInstance().getVocFileObject()));
String line = br.readLine();
while... |
a8d63cd8-f3fc-4d57-844d-3507d26b066c | 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... |
6666c709-ff4c-463f-ad6e-54439ff4bfcb | 4 | public void storeClasses() {
if (destDir.endsWith(".jar") || destDir.endsWith(".zip")) {
try {
ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(
destDir));
basePackage.storeClasses(zip);
zip.close();
} catch (IOException ex) {
GlobalOptions.err.println("Can't write zip file: ... |
8028f946-a3fb-416f-880a-f2fddcfc0181 | 6 | private double getCreditRating(Player player) {
double interestToReturn = 0;
//Daten auslesen
Vector<PlayerData> data = player.getData();
double playerCash = player.getCash();
Vector<LongTimeCredit> creditsOfPlayer = player.getCredits();
double totalAmountOfCredits = 0;
double debtRatio = totalAmountOfCre... |
6dd1173c-bb5f-42f8-840b-05c5c5a12488 | 3 | public int getDifferentRotationCount() {
switch (this.getShape()) {
case I:
return 2;
case L:
return 4;
case T:
return 4;
default:
throw new UnsupportedOperationException();
}
} |
7d122242-e921-4f07-b5f0-3d391574bd86 | 7 | @Override
public void draw() {
// TODO Auto-generated method stub
graphics.draw(backgroundImage, 0, 0, window.scale());
drawTable(5,6,(int)(100*window.scale()),(int)(200*window.scale()),(int)(1200*window.scale()),(int)(600*window.scale()));
graphics.print("IP",210, 240,3);
graphics.print("Name", 380, 240,3);
gra... |
9cad008b-97b7-4028-9d7d-5c78a37fa232 | 0 | public String getCurrentMonth() {
return currentMonth;
} |
6e1b3d4f-d684-43f9-813f-56e30237489c | 3 | public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue... |
36888ca2-057e-4c5f-978e-caaa6d9e30f0 | 8 | public static int serveFile(File base, String context,
Request req, Response resp) throws IOException {
String relativePath = req.getPath().substring(context.length());
File file = new File(base, relativePath).getCanonicalFile();
if (!file.exists() || file.isHidden()) {
r... |
6e6eb1e6-72af-4d13-a8fa-a6af98457059 | 6 | public void bufferTrailerPosition(RsMotion motion){
if(lastNode==null){
// this will happen only if we've never set properties.
// in such a case, there is no point to buffering a point
return;
}
if(!lastNode.activationStatus || lastNode.color==null || lastNode.wTrailer<=0)... |
981d5d65-5dd4-4b8c-9589-89b32fee4b69 | 4 | public StorageUtil(Component parentIn){
compParent = parentIn;
if(checkDirectory()){
if(checkBin()){
}
if(checkLog()){
}
if(checkProjects()){
}
}
} |
fed8e4f0-6db4-4fa8-8769-c1b0c38cc45e | 1 | @Override
public void onEntityHit(Player p, MapObject mo) {
int bonus = 0;
if(p.invArmor.getStackInSlot(3) != null){
ItemTool weapon = (ItemTool) p.invArmor.getStackInSlot(3).getItem();
bonus = weapon.getAttackDamage();
}
health -= p.getAttackDamage() + bonus;
} |
d626076f-1488-4c77-84df-fb8b2fd174e3 | 8 | private void updateOfferItems() {
goldOfferPanel.setAvailableGold(player.getGold());
if (unit.isCarrier()) {
List<Goods> goodsAvail = new ArrayList<Goods>();
if (unit.getOwner() == player) {
goodsAvail.addAll(unit.getGoodsList());
} else {
... |
c7fc8589-bdd8-43c8-a97c-1877b8cbb925 | 2 | public void setGroutingColor(Color c) {
if (c == null || ! c.equals(groutingColor)) {
groutingColor = c;
forceRedraw();
}
} |
81e58cc2-9d13-4463-a792-8899e4b48106 | 9 | public Set<Move> validMoves(PlayerType player) {
if (player == PlayerType.WHITE && null != this.whiteMoves) {
return this.whiteMoves;
}
if (player == PlayerType.BLACK && null != this.blackMoves) {
return this.blackMoves;
}
Set<Move> validMoves = new HashSe... |
3a1be9d2-6fd3-4e42-b982-1eab5f117b41 | 6 | static int divide(int x, int y){
//x/y by adding y to itself quotient times until reach x value
int sum=0;
int quotient=0;
if(abs(x)<abs(y)) return divide(y, x);
while(sum<=abs(x)){
sum+=abs(y);
quotient++;
}
if((x>0&&y<0)||(x<0&&y>0)){
return negate(quotient-1);
}
else return (quotient... |
58155ee4-b0d1-4cf6-b0d0-87ee1109165a | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false... |
3c020240-7980-4d01-bf80-ab0348e42c28 | 6 | Message(int type, int i_0_, String string, String string_1_,
String string_2_, String string_3_, int i_4_, String string_5_) {
try {
((Message) this).anInt2031
= Entity.method2408((byte) 53);
((Message) this).aString2028 = string_5_;
((Message) this).type = type;
((Message) this).aString203... |
47167fb6-71ab-487e-b952-0fd15f946492 | 5 | @RequestMapping(method = RequestMethod.POST)
public @ResponseBody JsonResponse maintenanceAuth(@RequestParam(value = "email", required=true) String email,
@RequestParam(value = "password", required=true) String password,
@RequestParam(value = "recaptcha_challenge_field", required=false) String challenge,
@Req... |
d4050373-0393-4668-a823-acec94020da7 | 2 | @Override
public FutureMeeting getFutureMeeting(int id) {
Meeting returnMeeting = getMeeting(id);
if(returnMeeting != null) {
// Added a check to see if the meeting is now in the past
// and throws and exception if this is the case. This is not in
// the specifica... |
a9ff114f-2979-45c2-9b50-ac8f0b7f9213 | 3 | public static void loadConfig(String file) {
FileReader reader = null;
try {
reader = new FileReader(new File(file));
configuration.load(reader);
} catch (Exception e) {
System.out
.println("["
+ new Timestamp(new Date().getTime())
+ "] Linea inadecuada"
+ " en el archivo de con... |
60b8f276-c0c0-4ec8-9b02-529d792bb603 | 3 | public List<JSONObject> take(int maxWaitMillis) throws InterruptedException {
List<JSONObject> result = new ArrayList<JSONObject>();
lock.lock();
try {
if (samples.size() < batchSize) {
lessThenBatchSizeCondition.await(maxWaitMillis, TimeUnit.MILLISECONDS);
... |
6cbdc41c-b47a-41ad-94ad-9a422106e4a3 | 4 | private final String decode(final String val) throws SAXException {
StringBuffer sb = new StringBuffer(val.length());
try {
int n = 0;
while (n < val.length()) {
char c = val.charAt(n);
if (c == '\\') {
... |
6ade9fba-fa07-4610-b4d9-9654d4279452 | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} ... |
68a881f0-ecb7-4edf-a4f8-f4fe921b62df | 8 | public void displayTheStack() {
int increment = 0;
int numberOfRows = (arraySize / 10) + 1;
for (int m = 0; m < numberOfRows; m++) {
increment += 10;
for (int n = 0; n < 71; n++)
System.out.print("-");
System.out.println();
for (int n = increment - 10; n < increment; n++) {
System.out.... |
5f6d7f63-7bc6-4629-829e-6b560022e801 | 1 | public void destroyAll() {
for (Widget wdg = child; wdg != null; wdg = wdg.next) {
wdg.destroyAll();
}
unlink();
} |
8c8941e8-4750-4626-b4e6-0d391e846a0d | 1 | public void met(int file, int at) {
RendezVous rv = meetings.get(file);
if (rv != null) {
rv.met(at);
} else { // word has not met in that file before
meetings.put(file, new RendezVous(file));
meetings.get(file).met(at);
}
} |
8f621a69-e9af-404f-b7a8-227849a0dfd6 | 0 | public void setPort(int port) {
this.port = port;
} |
218f77b0-45d5-4152-9767-f6a72e78bd80 | 4 | /* */ private void checkOutOfBounds()
/* */ {
/* 137 */ if (this.x < 0) {
/* 138 */ this.x = 0;
/* */ }
/* 140 */ if (this.x + 32 > 800) {
/* 141 */ this.x = 768;
/* */ }
/* 143 */ if (this.y > 448) {
/* 144 */ this.y = 448;
/* */ }
/* 146 */ if (thi... |
c16e1c91-7c17-47c3-9f38-560478723c83 | 6 | public void testRemoveAllArray() {
int element_count = 20;
int ints[] = new int[element_count];
for ( int i = 0; i < element_count; i++ ) {
ints[i] = i;
}
TIntList list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.a... |
63b3f545-0565-44bd-a56e-3af8ca2408fe | 8 | public Tile findIsolated()
{
ArrayList<GameEntity> all = new ArrayList<GameEntity>();
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
if (tiles[r][c].occupants.size() > 0)
all.add(tiles[r][c].occupants.get(0));
}
}
int r = 0, c = 0, maxDist = 15;
out:
while (true)
... |
80318c20-d9a3-4f5b-b881-0e6950091f03 | 0 | public void setUserId(String value) {
this.userId = value;
} |
28dfee3f-425d-4da0-aeeb-1586ad3c41f3 | 7 | @Reflectable
public static String getAllMethods(String pkg, String clazz) throws ClassNotFoundException
{
Annotation[] annotations = null;
StringBuilder sb = new StringBuilder();
Class<?> c = Class.forName(pkg + "." + clazz);
Class<?> interfaces[] = c.getInterfaces();
while( c != null )
{
annotations... |
ee78a2e6-9696-480f-bdd2-7b4a5e29fe18 | 1 | private void jLabel14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseClicked
try {
URI website = new URI(this.newSourceCode);
openUriInBrowser(website);
} catch (URISyntaxException ex) {
ex.printStackTrace();
}
}//GEN-L... |
48cd06ab-85a4-43b4-86b6-1cdd9d0ba849 | 1 | public <T> T apply(T instance) throws Exception {
if (instance instanceof ParamsAware) {
((ParamsAware)instance).setParams(global);
}
return instance;
} |
ac786ae2-f866-44e8-b657-b730bb8e0026 | 6 | public void update() {
player.update();
player.checkAttack(enemies);
player.checkCoins(coins);
finish.update();
finish.checkGrab(player);
bg.setPosition(tileMap.getx(), 0);
tileMap.setPosition(
GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety());
... |
03eded5c-3a80-4334-affd-469663a211ef | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boole... |
75c8837d-dd02-417d-939c-7a77be772fae | 6 | private ImageProcessor regionTight(ImageProcessor region, double minBright, double minHeight, int width, int height){
// region.resetMinAndMax();
// ImageProcessor mask = region.convertToByteProcessor(true);
// enhance.setNormalize(true);
// enhance.stretchHistogram(mask, 1);
// mask.blurGaussian(2.5);
// mask.th... |
557becf0-d22a-46e3-a20b-e94e1140d07c | 2 | public static void main (String[] args) {
System.out.println("This class should do something awesome!");
for (int i = 0; i < 43; i++) {
if (i > 41) {
System.out.println(i);
}
}
} |
3c4c992e-e5cb-4fa5-8816-40d1b2698095 | 0 | public Huffer (Player player){
this.player=player;
largestCapture=setToBeHuffed();
} |
25e39a95-e380-4d33-bda8-3f4bad37fe2a | 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... |
c3d4de3d-51ef-4d59-847b-ec912cca1cd3 | 7 | public AbstractElement(StringBuilder str) {
element = new String(str);
element = element.replaceAll(" "," ").replaceAll("\\s+", " ");//чистим управляющие символы и двойные пробелы
//TODO реализовать очистку спецсимволов html
element = element.trim();
charArray = element.to... |
3037ae10-edd1-411f-a991-86ebae5b5566 | 4 | @Override
public int hashCode() {
int hash = 0;
hash += (a == null ? 0 : a.hashCode());
hash += (b == null ? 0 : b.hashCode());
hash += (c == null ? 0 : c.hashCode());
hash += (d == null ? 0 : d.hashCode());
return hash;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.