method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7873861a-adfd-4fed-93dd-f1e90462c055 | 7 | public static boolean
listsAreIdentical(
List list1,
List list2 )
{
if ( list1 == null && list2 == null ){
return( true );
}else if ( list1 == null || list2 == null ){
return( false );
}
if ( list1.size() != list2.size()){
return( false );... |
6a144963-51e6-46f5-847a-ecbfe5f9347d | 0 | public synchronized boolean getBoolean(ConfigValues path) {
return this.yaml.getBoolean(path.getPath());
} |
21023a1e-57c2-4f08-894e-2e671e47eaa6 | 6 | static float rateArea(Plantation allots[], World world) {
//
// Favour fertile, unpaved areas close to the parent botanical station but
// farther from other structures-
float
fertility = 0, num = 0,
minDist = World.SECTOR_SIZE, parentDist = 0 ;
for (Plantation p : allots) {
pare... |
b060c3f1-b826-408d-9532-f5e603660b6e | 8 | public boolean stringsAreAnagrams(String string1, String string2) {
logger.debug("Start stringsAreAnagrams: string1 = " + string1 + ", string2 = " + string2);
long startTime = System.nanoTime();
boolean stringsAreAnagrams = true;
HashMap<Character, Integer> characterMap = new HashMap<Ch... |
0d07471d-5eb4-45e1-88c4-5d9aae8a64a5 | 6 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
String method = Util.nullToString(request.getParameter("method"));
if("viewA... |
edbdb90c-f95b-482a-9cf8-c4ebaf1654fe | 5 | public void browserAddObject(String objectName, String targetPath) {
String objectPath;
FileableCmisObject object;
if (browseFolder.isRootFolder()) {
objectPath = browseFolder.getPath() + objectName;
} else {
objectPath = browseFolder.getPath() + "/" + objectName;... |
4c6ba75a-73ed-4010-a3f1-4a697b814acc | 8 | private String showNode(TreeNode node, boolean[] hasBar){
StringBuffer text = new StringBuffer();
for(int i=0; i < (node.level - 1); i++)
if(hasBar[i])
text.append(" | ");
else
text.append(" ");
if(node.level != 0)
text.append(" |------ ");
text.append(node.value+"("+node.lev... |
0196c236-e259-4b55-b691-89d486b04eeb | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result
+ ((coverUrl == null) ? 0 : coverUrl.hashCode());
result = prime * result
+ ((description == null) ? 0 : description.hashCode());
res... |
fa88db5e-07fc-4cd7-ab86-65c9cfc95903 | 8 | @Override
protected void onMessage(final String channel, final String sender,
final String login, final String hostname, String message) {
boolean consume = false;
if (channel.equals(getIntendedChannel())) {
int cmdPre = 0;
if (message.toUpperCase().startsWith(getNick().toUpperCase() + ":")) {
cmdPre ... |
b000e801-03bb-4828-a365-d094986eec1c | 8 | public static void main(String[] args) throws IOException, InterruptedException {
System.out.println("Server started. For exit write " + '\"' + COMMAND_EXIT + '\"');
startServerSocketListener();
startActivityDeathListener();
try {
chatHistory.addMessageList(DbFactory.getMes... |
6bdd3bfb-3fcc-49fa-b449-e92844ca0131 | 8 | public void testAddAndRemoveRoom() throws RoomNumberExistsException, Exception {
rm.addRoom("TestRoom2", 2, RoomType.DOUBLEROOM);
Room tmp = null;
Iterator<Room> it = rm.getRoomList().iterator();
boolean check = false;
while (it.hasNext()) {
Room r2 = it.next();
... |
f3dc37dc-54ee-4610-a31b-261b80e615c4 | 4 | @Override
public void run() {
tasksProcessed = 0;
final long startTime = System.currentTimeMillis();
Thread executorThread = Thread.currentThread();
while (!executorThread.isInterrupted()) {
try {
final T t = taskSupplier.pull();
if (t != n... |
87f3b564-693b-4cf7-b6fc-13ead2b2d646 | 3 | public void paginae(Message msg) {
synchronized (paginae) {
while (!msg.eom()) {
int act = msg.uint8();
if (act == '+') {
String nm = msg.string();
int ver = msg.uint16();
paginae.add(Resource.load(nm, ver));
} else if (act == '-') {
String nm = msg.string();
int ver = msg.uint... |
e0360916-9dbc-446c-971f-6365526e4994 | 3 | public static int[] ordenarVector(int[] n) {
int aux=0;
int j=0;
for (int i =0; i>n.length;i++){
for(j=i+1; j<n.length; j++){
if(n[i]>n[j])
{
aux = n [i];
n [i] = n [j];
n [j] = aux;
}
}
}
return n;
} |
8ac03ad9-bb69-4571-b64d-335aee5bba26 | 7 | public static Vector localSearch(Vector v) {
// Incrementally optimize this vector
v = v.clone(); // don't modify the original
double bestLength = Double.MAX_VALUE;
Vector bestVector = v.clone();
int[] increments = new int[] { -4, 1, 1, 1, 1, 1, 1, 1, 1, -4 };
boolean ... |
9bc025e4-91b9-4a60-bbbc-c245878b5451 | 2 | public void sendReadyRequest() {
playerIsReady = true;
Message<ePlayerState> ready = new Message<>();
ready.setMessageType(eMessageType.playerState);
ready.setDataContainer(ePlayerState.Ready);
oponent.sendMessage(ready);
// cant start game wait till openent is ready
... |
b62478c2-abf2-4b35-b9e8-261e3084f025 | 9 | public void keyReleased(KeyEvent keyEvent) {
if(keyEvent.getKeyCode() == KeyEvent.VK_LEFT ||
keyEvent.getKeyCode() == KeyEvent.VK_RIGHT ){
iDireccionCanasta = 0;
}
// Si haces clic en g se Guarda
// previene que se pueda guardar o cargar en pausa o intruc... |
23bf0085-e2cc-46ec-8741-c6683a59392f | 4 | public void drawComponents(BufferedImage canvas, boolean drawCorner)
{
if (_components == null)
findComponents();
BufferedImage image = new BufferedImage(_width, _height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < _width; x++)
for (int y = 0; y... |
518e1a62-280d-4fe6-bc18-7619320c0f32 | 2 | public FilterModule getFiltre(String ID)
{
FilterModule fm;
for (Iterator<FilterModule> e = filtres.iterator(); e.hasNext();) {
fm = e.next();
if (fm.getID().equals(ID))
return fm;
}
return null;
} |
691f90c2-950b-4aa6-83a5-b4bf8c572e47 | 6 | public static String getMAC() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface network = networkInterfaces.nextElement();
byte[] mac = network.... |
4ed713f7-aa5a-45f9-92af-a148e297038a | 8 | public static Stella_Object accessMemoizationTableSlotValue(MemoizationTable self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_HASH_TABLE) {
if (setvalueP) {
self.hashTable = ((IntegerHashTable)(value));
}
else {
value = self.hashTab... |
8245820b-ba68-4aea-b4cb-574080da4870 | 0 | public ImportingModuleEngine(AlgorythmFile algorythmFile){
this.algorythmFile = algorythmFile;
// int[] intArray = null;
// float[] floatArray = null;
// String[] stringArray = null;
} |
7cfa33e3-c48c-4710-9664-dba011cfc7fc | 1 | @Override
public void execute(ArrayList signature) {
String formatType = (String) signature.get(1);
String className = (String) signature.get(2);
String formatName = (String) signature.get(3);
Vector extensions = null;
if (signature.size() > 4) {
extensions = StringTools.split((String) signature.get(4), ... |
582bc74e-7239-4942-819f-0f48cacf6941 | 4 | @Override
public OutputStream getOutputStream() throws IOException
{
if(toNetStream == null) {
toNetStream = new OutputStream() {
@Override
public void write(int value) throws IOException
{
try {
BaseConnectionEndPoint.this.write(new byte[] { (byte)value });
}
catch(NetworkExcept... |
9294fad7-1ff7-4918-997b-080bdcc0b783 | 9 | @Override
public void onEnable() {
instance = this;
getDataFolder().mkdir();
log = getLogger();
nameLoader = new NamesLoader(this);
nameLoader.writeDefault("config.yml", false);
nameLoader.writeDefault("custom.yml", false);
nameLoader.writeDefault("tier.yml", false);
nameLoader.writeDefault("set.yml", ... |
9e6a017b-ba34-4e0c-94ac-1aba22f9275a | 0 | public String getName() {
return this.name;
} |
62d29f07-c684-43d0-ac20-b98fc3a12cf3 | 0 | public String getImagen() {
return imagen;
} |
c71d66f2-8a3f-4b89-89a7-e9cbe1a6b666 | 8 | private String extractPosition(String idref)
throws IDrefNotInSentenceException, FeatureValueNotCalculatedException {
String position = "";
/*
* Possible cases:
* 0 - idref in front of the separated target 1 - idref
* inbetween of the separated target 2 - idref in front of a single
* target
* 3... |
0c1a5c50-e779-4710-b520-c98d587564b8 | 6 | public void getSetUp()
{
if (setUp == false)
{
if (P2character.equals("White"))
{
getWorld().addObject(whiteKnight,100,400);
}
else if (P2character.equals("Bond"))
{
getWorld().addObject(jamesBond,100,400);
... |
32710fc4-c285-476f-8561-0150fea85e41 | 8 | public String getValue()
{
StringBuffer returnedValue = new StringBuffer();
String tempValue = getValueWithZeros();
boolean leadingZero = true;
for (int x = 0; x < tempValue.length(); x++)
{
if (tempValue.charAt(x) != '0')
{
leadingZero = false;
returnedValue.append(tempValue.charAt(x));
}
... |
a836c149-dd40-456a-8464-c5d7d59d3073 | 8 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (this.getElements() == null) {
return;
}
Collection<Player> players = Game.getInstance().getPlayers().values();
int size = this.cols * this.rows;
for (int index = 0; index < si... |
1888413e-cec9-4511-9581-754d7c8c2214 | 6 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event)
{
if(event.getAction() == Action.LEFT_CLICK_BLOCK)
{
if(plugin.posIsWithinColdBiome(event.getPlayer().getTargetBlock(null, 5).getX(), event.getPlayer(... |
487eb9c1-271a-405e-a5bc-535e0dea4a83 | 1 | public mController()
{
//Run the game until finished
while (isRunning == true)
{
//prompt user with choices and process input
choiceMade(choiceOptions());
//Print the updated map
System.out.print... |
c9186c90-24bb-4d67-9124-adf4a906ea93 | 8 | public static Stella_Object accessTransitiveClosureIteratorSlotValue(TransitiveClosureIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_ALLOCATE_ADJACENCY_ITERATOR_FUNCTION) {
if (setvalueP) {
self.allocateAdjacencyIteratorFunction = ((FunctionCo... |
18ce346c-1270-4b74-85b6-c88d10acd627 | 6 | private void carregaDados() {
lblLocalidade.setText(atracao.getLocalizacao());
double preco = ((Hotel) atracao).getPrecoMedio();
if (preco == 0) {
lblPreco.setText(bundle.getString("Gratis"));
} else {
lblPreco.setText(((Hotel) atracao).getPrecoMedio() + "€");
... |
eecaca77-bf9e-4201-8298-6ec44cc087ba | 1 | public void draw(Graphics2D g2d) {
for (MovingSquare movingSquare : movingSquares) {
movingSquare.draw(g2d);
}
} |
29ecb812-ae0c-45b8-af91-01990a814eff | 4 | public void toggleType() {
speedSpinner.setEnabled(false);
piercingCheck.setEnabled(false);
distanceSpinner.setEnabled(false);
damageSpinner.setEnabled(false);
diameterSpinner.setEnabled(false);
multiCheck.setEnabled(false);
movingCheck.setEnabled(false);
durationSpinner.setEnabled(false);
areaTexture... |
9b8fd272-612c-4d49-ab65-5e55286e45b8 | 9 | public Forecast getForecast() {
switch (arr[89]) {
case 8:
return Forecast.MOSTLY_CLEAR;
case 6:
return Forecast.PARTLY_CLOUDY;
case 2:
return Forecast.MOSTLY_CLOUDY;
case 3:
return Forecast.MOSTLY_CL... |
40842f28-705c-4380-89de-712934889d97 | 4 | private void setPanelVisible(String panel) {
switch(panel) {
case "dicePanel":
isDicePanel();
break;
case "calculatorPanel":
isCalculatorPanel();
break;
case "standAloneMusicPlayerPanel":
isMusicPlayer();
break;
case "none":
isNone();
defaul... |
b1402f7a-9f1b-4397-9785-4bfb59a0e37e | 9 | private void updateGameState() {
if (allFieldsSet()) {
state = BoardState.DRAW;
return;
}
if (inOneRow(0, 1, 2)
|| inOneRow(3, 4, 5)
|| inOneRow(6, 7, 8)
|| inOneRow(0, 3, 6)
|| inOneRow(1, 4, 7)
|| inOneRow(2, 5, 8)
|| inOneRow(0, 4, 8)
|| inOneRow(2, 4, 6)
) {
state = Boa... |
7f705c38-2060-4740-afc7-102bee67649a | 3 | private String parsePDF() throws FileNotFoundException, IOException
{
String result = "";
_logger.debug("Filetype = PDF");
PDFParser pdfParser = null;
PDFTextStripper pdfStripper;
PDDocument pdDoc = null;
COSDocument cosDoc = null;
// PDDocumentInformation pdDocInfo;
try
{
// Der PDF parse Vorga... |
91285bb2-41f1-4dd9-b5cf-d700eef1616b | 3 | int showBMPDialog() {
final int [] bmpType = new int[1];
bmpType[0] = SWT.IMAGE_BMP;
SelectionListener radioSelected = new SelectionAdapter () {
public void widgetSelected (SelectionEvent event) {
Button radio = (Button) event.widget;
if (radio.getSelection()) bmpType[0] = ((Integer)radio.getData()).in... |
30a92229-be13-41c6-b44d-22911ef4750a | 2 | public void matrixLineByLine (ArrayList<Picture> picList, int startFrame) {
Picture srcPic = null;
for (int frameNo = 0; frameNo < super.matWidth; frameNo++) {
srcPic = picList.get((frameNo + startFrame) % picList.size());
stackLineByLine(srcPic.getY(), super.arrY, frameNo, srcPi... |
9de2a3c2-6a3f-449c-9974-99dc8229f37b | 5 | public static void modifyVehicleMake(Scanner ifile1, PrintWriter ofile1,
String vehicleMake, String newVehicleMake)
{
/* initialize variables */
int fieldCount = 0;
int fieldOfInterest = 2;
int recordCount = 0;
int recordsInFile = 4260... |
60b155d9-79c0-4ada-9f3a-8906493bf214 | 3 | public boolean isAllEmpty(){
for(boolean[] bool_ : coordoneeJeu)
for(boolean bool : bool_)
if(bool)
return false;
return true;
} |
582c6e18-4e34-44c6-aa0f-87b2acde0c2f | 3 | public void setLeft(PExpLogica node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
bdab76ec-1db2-4874-9023-d400199a2384 | 6 | public UnicodeInputStreamReader(InputStream source, String encoding) throws IOException
{
defaultEnc = encoding;
String enc = encoding;
byte[] data = new byte[4];
PushbackInputStream pbStream = new PushbackInputStream(source, data.length);
int read = ... |
1c3e58cf-8ca8-49ec-9955-679932c4db29 | 1 | public void addInformations(List<String> list)
{
for(String info : list)
informations.add(info);
//nbInformation += code.size();
nbInformation = informations.size(); // source à problème
updateSize();
} |
9f6f03ce-d3b1-40ee-9598-8e48c964572a | 2 | @Override
public void update() {
if(team == 1){
counter1 ++;
}
else if(team == 2){
counter2 ++;
}
//war.updateScore(counter1, counter2);
} |
e1d6679e-445f-4817-9081-4ef300e26610 | 8 | public void indexLine(String line) {
if (line.length() > 0) {
System.err.println ("Check for link reff: " + line);
// check for up to 3 spaces?
if (line.charAt(0) == '[') {
StringBuilder linkId = new StringBuilder();
StringBuilder urn = new StringBuilder();
StringBuilder caption = new StringBuild... |
e750e02c-ae7a-421f-bd92-8ae47f7317b5 | 5 | public WhirlycottCacheImpl() {
FileInputStream myInputStream = null;
Properties config = null;
String fileCfg = "./conf/whirlycache/default.ini";
try {
config = new Properties();
myInputStream = new FileInputStream(fileCfg);
config.load(myInputStream);
} catch (Exception e) {
logger.severe("Could ... |
669d7b93-cd77-4962-86c6-a63b617e54f7 | 1 | public Constant newDouble(final double value) {
key1.set(value);
Constant result = get(key1);
if (result == null) {
result = new Constant(key1);
put(result);
}
return result;
} |
c1b0aa2e-9d87-4e43-b669-3af680d9a847 | 8 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("How many A's did you recieve in this last semester of school?");
int x = scan.nextInt();
switch(x) {
case 0: System.out.println("Do better next time");
break;
case 1: System.out.println("You can do bet... |
85c2c8a7-2a13-42d6-863d-ebbac86745cf | 7 | @Override
public int authenticateAdmin(Connection conn, String userName,String password)
{
String sql = "SELECT * FROM admin where username = ? and password = ?";
PreparedStatement stmt = null;
ResultSet result = null;
try
{
stmt = conn.prepareStatement(sql);
stmt... |
22087bf1-4d0a-4944-97a2-87efdd3b0566 | 0 | public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
} |
e2f1ef5e-9888-41ad-a836-a487223c23d6 | 1 | public String toString(ItemStack[] stack, int x) {
this.itemIDH = stack[x].getTypeId();
this.amountH = stack[x].getAmount();
this.durabilityH = stack[x].getDurability();
if (stack[x].getData() == null) {
return this.itemIDH + "," + this.amountH + "," + "!" + "," + this.durabi... |
f64cdfa4-a6d8-4ea0-b5fd-201aed777d8d | 3 | private String encode(final String url) {
String res = "";
for (char c : url.toCharArray()) {
if (!":/.?&#=".contains("" + c)) {
try {
res += URLEncoder.encode("" + c, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new CrawlerException(
"There is something really wrong with y... |
b6c8da07-b51f-4a69-a501-b159515bcf68 | 3 | private boolean isTargetOperator(Token cur) {
if (!cur.isOperator())
return false;
for (Operator target: targetOperators) {
if (target.equals(cur.getOperator()))
return true;
}
return false;
} |
da4383f6-529e-4e94-a591-42f8c55c7935 | 8 | private void entityModified(EntityRef entity) {
int entityId = internalEntityManager.getEntityId(entity);
for (Map.Entry<String, Set<Integer>> clientKnownEntities : entitiesClientIsAwareOf.entrySet()) {
String clientId = clientKnownEntities.getKey();
EntityRef clientEntity = clie... |
ebab94a1-edf9-4a82-9996-ac9de486188a | 4 | protected boolean collision(double xa, double ya) {
boolean solid = false;
for (int c = 0; c < 4; c++) {
double xt = ((x + xa) - c % 2 * 5 - 5) / 16;
double yt = ((y + ya) - c / 2 * 15 + 15) / 16;
int ix = (int) Math.ceil(xt);
int iy = (int) Math.ceil(yt);
if (c % 2 == 0) ix = (int) Math.floor(xt);
... |
74f27511-27fa-4f79-ad63-9f186f3ae2ff | 2 | private void actionRandom( )
{
int m = Matrix.getNumOfRows(matrix);
int n = Matrix.getNumOfColumns(matrix);
for (int i = 0; i < m; ++i)
for (int j = 0; j < n; ++j)
{
matrix[i][j] = Math.random();
matrixTF[i][j].setText(Double.toString(matrix[i][j]));
}
repaint();
} |
bab342fe-9554-4b4a-bdad-3ff1e44869c3 | 0 | public boolean isConnected() {
return socket.isConnected();
} |
81b9a9a6-8de3-4c29-92f2-f2dc493e9d06 | 9 | private static String convertOneDigit(final char digit) {
switch (digit) {
case '1' : return "one";
case '2' : return "two";
case '3' : return "three";
case '4' : return "four";
case '5' : return "five";
case '6' : return "six";
... |
4e756498-d526-40dc-99e8-5b6dd4cf7ab4 | 9 | public MBJComponent() {
mbImage = new MBImage();
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
if (!selectJulia) {
if (e.getButton() == MouseEvent.BUTTON1) {
p1 = e.getPoint();
}
}
}
@Override
public void mouseClicked (Mouse... |
be9832ac-fe2a-41b3-b10e-48752d115885 | 7 | static void dradb2(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index){
int i, k, t0, t1, t2, t3, t4, t5, t6;
float ti2, tr2;
t0=l1*ido;
t1=0;
t2=0;
t3=(ido<<1)-1;
for(k=0; k<l1; k++){
ch[t1]=cc[t2]+cc[t3+t2];
ch[t1+t0]=cc[t2]-cc[t3+t2];
t2=(t1+=ido)<<1... |
4bb0284f-00ac-4f10-9941-5a5098f21e3b | 8 | public static boolean computeCell(boolean[][] world, int col, int row)
{
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(world, col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(world, col... |
b87d7759-f073-4a0b-b7c7-c9f705cc8513 | 7 | public String censorMessage(String message) {
boolean censored = false;
boolean uncensored = false;
for (Map.Entry<String, String> entry : wordList.entrySet()) {
String thisWord = entry.getKey();
String thisValue = entry.getValue();
String thisRegex = "\\b"+thisWord+"\\b";
Pattern patt = Pat... |
ad6ec7fc-7a0b-4678-b7fe-fe9772007d9d | 9 | public void run(){
long startTime, endTime;
double execTime;
switch (sortToRun) {
case 'I':
// Take intrinsic lock on 'System' class
// to prevent thread interference in timing measurements.
synchronized(System.class){
startTime = System.nanoTime();
InsertionSort<T> insertObj ... |
3ffde841-fe14-4abf-abdf-aa4258fc0b20 | 6 | public void renderBlockFallingSand(Block par1Block, World par2World, int par3, int par4, int par5)
{
float var6 = 0.5F;
float var7 = 1.0F;
float var8 = 0.8F;
float var9 = 0.6F;
Tessellator var10 = Tessellator.instance;
var10.startDrawingQuads();
var10.setBrigh... |
44c0f50a-62e2-4129-a54e-fc4b87ce7f95 | 5 | public static void FileFinder(String myDirectoryPath) {
File directory = new File(myDirectoryPath); //file object that is used to find an individual directory path
File[] directoryListings = directory.listFiles(); //list of file objects in a particular folder
if(directoryListings!=null){
... |
e5de511d-0d01-4e42-9851-49e9d38e6a7a | 3 | private void drawAccuracyMessage(Graphics2D graphics) {
for (Entity entity : entities) {
if (entity instanceof Bullet && ((Bullet) entity).wasFiredByPlayer()) {
respawnTicks = 0; // Don't end until player sees accuracy
return;
}
}
String m... |
0ad9f0d5-2f53-42cf-a81b-5c712e857f15 | 3 | private String ParseIntoURLs(String urlStr) {
StringBuffer sb = Get10kSearchPage(urlStr);
String str = "";
int startIndex = 0, endIndex = 0;
while(true) {
startIndex = sb.indexOf("/Archives/edgar/data", endIndex);
if(startIndex == -1) {
break;
}
endIndex = sb.indexOf("\"", startIndex);
str = ... |
49ed1429-0415-406e-a6e8-a91ae5237b12 | 5 | public boolean isFortifyConnecting(Territory target) {
if (isConnecting(target))
return true;
HashMap<Territory, Boolean> checked = new HashMap<Territory, Boolean>();
ArrayList<Territory> territs = new ArrayList<Territory>();
territs.add(this);
while (territs.size() > 0) {
Territory territ = territs... |
04fc2411-820e-415f-92fb-1ebff47644b6 | 3 | @Test
public void test(){
ResourceManager file = ResourceManager.create().newFile();
try {
URI uri = new URI("/Users/kimgyupyo/study/project/workspace/sns/test.html");
file.setInfo().setUri(uri);
//TODO 파일위치값과 실행하는 부분과 연결점을 찾을수가 없다.
try {
... |
9e145bd1-4d20-42e3-9d61-87c83b816b85 | 3 | public static boolean deletestudent(int id) {
boolean result = false;
Connection con = getcon();
try {
String stusql = "delete from testtable where id=?";
PreparedStatement stmt = null;
stmt = getcon().prepareStatement(stusql);
stmt.setInt(1, id)... |
fda75d6d-e4cc-42d8-bf31-9575773117f5 | 1 | public int getAttributeDefaultValueType(String name, String aname)
{
Object attribute[] = getAttribute(name, aname);
if (attribute == null) {
return ATTRIBUTE_DEFAULT_UNDECLARED;
} else {
return ((Integer) attribute[2]).intValue();
}
} |
91faceec-d55a-451a-b44a-903c688d5358 | 5 | public static Class loadMainClass(String jarFileName) throws Exception {
Class clss = null;
try {
JarFile jarFile = new JarFile(jarFileName);
Enumeration enums = jarFile.entries();
while (enums.hasMoreElements()) {
JarEntry entry = (JarEntry)enums.nextElement();
if (entry.isDir... |
53d0685b-4fb9-4508-8055-9a82be5d1bb2 | 3 | public void moveRight()
{
if (units2.size() == 6) {
QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater może mieć maksymalnie 6 jednostek");
} else if (units1.size() == 0) {
QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater nie ma żadnych jednostek");
} else if (list1.curr... |
f4b6cb1c-5742-46dd-a7f4-92a2019c49d6 | 1 | public void fireHoistDepthChangedEvent(OutlinerDocument doc) {
hoistDepthChangedEvent.setOutlinerDocument(doc);
for (int i = 0, limit = outlinerDocumentListeners.size(); i < limit; i++) {
((OutlinerDocumentListener) outlinerDocumentListeners.get(i)).hoistDepthChanged(hoistDepthChangedEvent);
}
// Cleanup
... |
dccf1d8d-e455-4ee2-a5bb-c785158a91d5 | 5 | public static void commit(){
File settingsFile = null;
FileWriter fw = null;
BufferedWriter bw = null;
try {
settingsFile = new File(SETTINGS_FILE_NAME);
fw = new FileWriter(settingsFile);
bw = new BufferedWriter(fw);
Gson gson = new Gson();
bw.write(gson.toJson(config, Config.Settings.class));
... |
a9f23472-a82a-4533-8f3c-a15be8c92616 | 2 | public void put(Object obj, WeakReference<Object> wr)
{
Long id = (long) System.identityHashCode(obj);
List<WeakReference<Object>> bucket = buckets.get(id);
if (bucket == null)
{
bucket = new ArrayList<>();
buckets.put(id, bucket);
}
synchronized (bucket)
{
if (!bucket.contains(wr))
... |
76177b96-9515-4591-bf73-68754a2bcb45 | 4 | public void blur(final int[] IN, final int[] OUT, final int WIDTH, final int RADIUS) {
final int WIDTH_MINUS_1 = WIDTH - 1;
final int R2 = 2 * RADIUS + 1;
int tr = 0, tg = 0, tb = 0;
for (int i = -RADIUS; i <= RADIUS; i++) {
int rgb = IN[mod(i, WIDTH)];
tr += (rg... |
88566a68-a12a-49de-9712-e4ecad2abffd | 3 | private static int alignValue(int value)
{
if(value != UNDEFINED) {
if(value < 0) return 0;
if(value > 100) return 100;
}
return value;
} |
c8a0e76b-ada5-4e79-b6a2-901675acca97 | 3 | private CreativeMaterialListResponse typedCreativeMaterialList(
final String roomEventIdStr, final String creativeMaterialTypeName
) {
Boolean success = true;
String errorMessage = null;
List<CreativeMaterial> creativeMaterialList = null;
Long roomEventId = null;
... |
dd518f1e-b9fe-4107-a377-779312ef2403 | 6 | public void renderGL(int delta) {
int ID;
int tmprendermode=rendermode;
RenderBlocks.renderNormalBlock((float) 500, (float) 500, (float) 500, true, 1, rendermode);
GL11.glRotatef(rotation.x, 1, 0, 0);
GL11.glRotatef(rotation.y, 0, 1, 0);
GL11.glRotatef(rotation.z, 0, 0, 1);
GL11.glTranslatef(thePlayer.x... |
dc29d39e-bbbc-47aa-a52a-3eef6b9fa0cc | 6 | public static void recursifDelete(File path) throws IOException
{
if(!path.exists())
{
throw new IOException("File not found '" + path.getAbsolutePath() + "'");
}
if(path.isDirectory())
{
File[] children = path.listFiles();
for(int i = 0; c... |
59d93dbc-2873-4cd4-9fce-6b541d751206 | 5 | public CodeMap set(final int index, final int value) {
final int i0 = index >>> 23;
int[][] map1;
if (i0 != 0) {
if (map == null)
map = new int[MAX_INDEX_ZERO][][];
map1 = map[i0];
if (map1 == null)
map[i0] = map1 = new int[MAX_INDEX_ONE][];
} else
map1 = map10;
final int i1 = (index >>>... |
6de499b8-6b49-4cee-a7b6-873fcdb7133e | 7 | private void UserVerbindenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserVerbindenActionPerformed
// TODO add your handling code here:
//Überprüfung ob verbunden oder getrennt werden soll
if(UserVerbinden.getText().equals("Verb... |
e763a9cd-24fb-49f8-9cad-7b207ed3848f | 2 | private boolean jj_3R_52() {
if (jj_scan_token(ELSE)) return true;
if (jj_3R_85()) return true;
return false;
} |
e579be04-1b43-4810-999d-b9b986790853 | 1 | public void visit_ifle(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_ifgt);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_ifle);
addBranch((Label) inst.... |
0b847ccd-9257-4a4e-a6f2-a5b9dea7fca4 | 1 | public CycLeaseEventObject(final Object source, final CycLeaseManagerReason cycLeaseManagerReason) {
super(source);
//// Preconditions
if (cycLeaseManagerReason == null) {
throw new InvalidParameterException("cycLeaseManagerReason must not be null");
}
this.cycLeaseManagerReason =... |
d9a313ca-3a28-47c4-97af-f2db178b7d89 | 7 | public boolean deleteVisitingHours(int visitingHourId)
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
boolean result=true;
try{
String sql="DELETE FROM OFFICE_HOURS WHERE office_hour_id=(?)";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
... |
8a798311-620b-4dd2-b406-7452669d0246 | 3 | public final void registerOption(final String flagId, final String tooltip,
char shortFlag, final String longFlag, boolean argExpected) {
this.dirty = true;
if (shortFlag != Flag.NoShortFlag) {
this.shortToId.put((int) shortFlag, flagId);
}
this.idToShort.put(flagId, (int) shortFlag);
if (longFlag != Fl... |
3a7c86fa-6141-4f0d-a158-5e6de2774523 | 1 | @Override
public void keyReleased( KeyEvent e ) {
for( KeyListener listener : listeners( KeyListener.class )){
listener.keyReleased( e );
}
} |
2383e78a-b748-4809-b9a9-b7326cb0016b | 3 | public void validate(Object obj, Errors errors) {
PriceIncrease pi = (PriceIncrease) obj;
if (pi == null) {
errors.rejectValue("percentage", "error.not-specified", null,
"Value required.");
} else {
logger.info("Validating with " + pi + ": " + pi.getPercentage());
if (pi.getPercentage() > maxPercent... |
6856ec6b-5c3d-4997-8d51-29b2e631c1d5 | 1 | public boolean setCellSecondPlayer(int x, int y){
if (cellIsFree(x,y)){
setCell(x,y, SECOND_PLAYER_CELL_VALUE);
return true;
} else {
System.out.println("This cell is not empty");
return false;
}
} |
800bb756-2d54-4bff-be1a-63d3586b8b75 | 7 | @Override
public void select(int howMany, Population from, Population to) {
List<Individual> individuals = new ArrayList<>();
for(Individual ind : from){
individuals.add(ind);
}
Collections.shuffle(individuals);
int size = 2;
while(size * 2 <from.getPopula... |
ebc002a5-9bd9-4dc9-9db0-caae4cc3e441 | 8 | private void moveScreen() {
Point screenPosition = MainClass.getLevelManager().getScreen().getScreenPosition();
if (getX() - screenPosition.x < Settings.SCREEN_WIDTH / 4) {
if (screenPosition.x != 0) {
screenPosition.x = (int) (getX() - Settings.SCREEN_WIDTH / 4);
}
} else if (getX() - screenPosition.x >... |
6cd041e7-cca8-4147-9b16-fe71c0c0fde4 | 6 | public boolean getBoolean(String key) throws JSONException {
Object o = get(key);
//#if CLDC!="1.0"
//# if (o.equals(Boolean.FALSE) ||
//#else
if (o.equals(FALSE) ||
//#endif
(o instanceof String &&
((String)o).toLowerCase().equals("false"))) {
return ... |
a1aa9eb7-4cec-48ed-9cb0-476fa853cafe | 7 | public List<GliderPosition> getRecentGliderPosition()
{
try{
List<GliderPosition> gliderPositions = DatabaseDataObjectUtilities.getGliderPositions();
List<GliderPosition> recentGliderPositionList = new ArrayList<GliderPosition>();
if(instance == null)
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.