method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
46bfb53c-9abd-494f-8af5-f598a678cfbf | 9 | protected static void nnbr(KDPlusNode kd, HPoint target, HRect hr, double max_dist_sqd, int lev, int K,
NearestNeighborList nnl) {
// 1. if kd is empty then set dist-sqd to infinity and exit.
if (kd == null) {
return;
}
// 2. s := split field of kd
int s... |
f1faa75a-f463-4ab5-ad9b-301e3c753873 | 0 | protected void end() {} |
3314eb6b-8538-4999-85f5-47c042802fa5 | 4 | static int findWhite(BitStream inb, Code code) throws IOException {
code.reset();
while (!inb.atEndOfFile()) {
int i = inb.getBits(1);
code.append(i != 0);
int j;
j = findPositionInTable(code, twcodes);
if (j >= 0) {
//System.er... |
46333d98-febe-461e-a693-e293ad70da6c | 2 | public Boolean checkTable(String table) {
DatabaseMetaData dbm;
try {
dbm = this.getConnection().getMetaData();
ResultSet tables = dbm.getTables(null, null, table, null);
if (tables.next()) {
return true;
}
else {
return false;
}
} catch (SQLException e) {
core.writeError("Failed... |
a12ad1a8-d7bd-45b1-86e8-3a1e1b7ba271 | 2 | protected void resaveParamsShowOrder(SessionRequestContent request) {
String validHotelStatus = request.getParameter(JSP_ORDER_VALID_STATUS);
if(validHotelStatus != null) {
request.setSessionAttribute(JSP_ORDER_VALID_STATUS, validHotelStatus);
}
String invalidHotelStatus = re... |
14b605d1-ca67-4065-8df4-f792a52ec273 | 0 | public String getOrderNumber() {
return orderNumber;
} |
54584607-ba29-457a-803a-8d0202437c20 | 8 | private int nextDigitalSegment(int box0){
// next adc
int nextAdc = nBoxes;
boolean endFound = false;
boolean test = true;
int ii = box0;
while(test){
if(this.adcs[ii]){
nextAdc = ii;
test = f... |
d771d79a-d44c-48fa-a627-0c23f23b7831 | 9 | private Boolean openFile() {
if (graphDrawingArea.wasModified()) {
switch (JOptionPane.showConfirmDialog(this, "O projeto atual foi alterado.\nAbrir um novo arquivo fará com que o arquivo atual seja perdido.\nDeseja continuar?", "Atenção!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, ((Icon)new ImageIc... |
254cbb7b-eddb-4fee-981e-a76c3357e3e4 | 5 | @Override
public void toFront() {
if (!isClosed()) {
if (getExtendedState() == ICONIFIED) {
setExtendedState(NORMAL);
}
super.toFront();
if (!isActive() || !isFocused()) {
Component focus = getMostRecentFocusOwner();
if (focus != null) {
focus.requestFocus();
} else {
requestFoc... |
f1dfa72d-b079-47cf-9795-737f15f38d4d | 8 | public boolean isEmpty() {
return ktivMale.isEmpty()
&& pronunciation.isEmpty()
&& lexicalClass.isEmpty()
&& gender.isEmpty()
&& rootWord.isEmpty()
&& form.isEmpty()
&& building.isEmpty()
&& netiyot.i... |
473609b7-d7dc-467a-b412-1dd40a2222fa | 4 | static private void BubbleDown(int index, int i, Highscore a[]) {
int child;
child = ((i+1)*2)-1;
if ( (child < index) && a[child+1].score < a[child].score )
child++;
if ( (child <= index) && a[i].score > a[child].score ) {
swap(a,i,child);
BubbleDown(index,child,a);
}
} |
d868b6fc-58ed-4e2a-9c23-3a846a1194ef | 3 | protected void processKeyEvent(KeyEvent ke) {
int kc = ke.getKeyCode();
if (ke.isShiftDown()) {
speed = SLOW;
rotAmount = Math.PI / 360.0;
} else {
speed = NORMAL;
rotAmount = Math.PI / 120.0;
}
if (ke.isAltDown()) {
altTransform(kc);
} else {
if (ke.isControlDown()) {
controlTransform... |
6ce701a6-84e9-48a3-b7f2-4c12dbf29f55 | 8 | private static DTRequest doRequest(DTRequest domainToolsRequest, URL url) throws DomainToolsException{
int response_code = 0;
StringBuilder sbResponse = new StringBuilder();
String sLine = "";
try{
System.out.println("url "+url);
httpConnection = (HttpURLConnection) url.openConnection();
httpConnectio... |
18d9a9bd-a7b3-42fe-bfa2-721733c70e59 | 3 | public String toString(){
String s ="";
for(int i=0; i<6; i++){
s=s+(jatsiyhdistelmat.get(i).name() + ": " + yhdistelmat.get(jatsiyhdistelmat.get(i))) + "\n";
}
s=s+"-------------------------------------------------"+ "\n";
s=s+("VALISUMMA: " + valisumma)+ "\n";
s=s+("BONUS: " + bonus)+ "\n";
s=s+"---... |
84973225-bbaf-4a4f-bf34-5f42ece3c8a0 | 7 | private void clear() {
if (zooKeeper != null) {
if (leaderOffer != null && zooKeeper.getState().isAlive()) {
try {
zooKeeper.delete(leaderOffer.getOffer(), -1);
LOG.debug("Removed leader candidate {}", leaderOffer);
} catch (Int... |
ce4796e2-b689-4294-b5f6-22bc51dcbedd | 6 | @Override
public void run() {
while(true){
synchronized (this) {
while(orderList.isEmpty()){
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
obOut.writeObject(orderList.remove(0));
obOut.flush();
} catch (IOException e) {
e.... |
f3458596-010c-49dc-820f-f55b0d3b58ba | 1 | public void creatLocalTestWorld(){
Dimension dim = new Dimension(0);
Region reg1 = new Region(0, 0,dim);
Region reg2 = new Region(1, 0,dim);
dim.loadRegion(reg1);
dim.loadRegion(reg2);
Chunk tmp1 =... |
03fe2075-656a-4b7a-9fe6-f73c8c096e92 | 4 | public void onEnable(){
plugin = this;
//command registering
CommandManager cmdman = new CommandManager();
cmdman.registerNewCommand("help", new HelpCommand());
cmdman.registerNewCommand("toggle", new ToggleHandler());
getCommand("notch").setExecutor(new CommandManager());
configfile = new File(getDa... |
7de1e2ae-f81b-44a4-8272-2242d24bab22 | 2 | private void initBundle(String baseName, Locale locale) throws IllegalArgumentException{
ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale);
lookup = new HashMap<String, String>();
inverseLookup = new HashMap<String, String>();
Enumeration<String> keys = bundle.getKeys();
String key;
Stri... |
1e4f4f39-bf35-4897-a801-399eb9130a1e | 1 | public BufferedImage getIcon(){
BufferedImage icon = null;
try {
//URL url = getClass().getResource("/Icons/"+this.name.replaceAll("\\s","").toLowerCase()+".png");
URL url = getClass().getResource("/Icons/empty.png");
icon = ImageIO.read(new File(url.getPath()));
} catch (IOException e) {}
return icon;... |
39243470-dcb7-4d74-ad6e-9ff8ae43c6f1 | 8 | public void actionPerformed(ActionEvent event)
{
if (event.getSource() == Gui.btnImportConfig)
{
JFileChooser importFileChooser = new JFileChooser();
importFileChooser.setDialogTitle("Select Pre-0.5.2 Config File");
importFileChooser.setFileFilter(new ConfigFileFilter());
importFileChooser.setAccep... |
e68be356-b8fa-4a4c-9828-632ccdf7c918 | 4 | public String getActualLogin(String login) {
Connection connection = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
connection = getConnection();
statement = connection.prepareStatement(userQuery);
int paramCount = u... |
09e47b4d-1deb-4a91-8a32-0712e4ee5e3a | 1 | public JProgramStatTable(final Field field) {
this.listener = new Vector<TableModelListener>();
this.data = new Vector<Map.Entry<Program, Integer>>();
this.field = field;
if (field == null) {
return;
}
field.addObserver(this);
setModel(this);
... |
f5e11ab4-7d9f-4fb2-8b19-4e202c8f767c | 6 | public void loadBlackjackSettings(File file)
{
if (!file.exists()) {
try {
file.createNewFile();
}
catch (Exception localException)
{
}
InputStream is = getClass().getResourceAsStream("/blackjack.yml");
try
{
FileOutputStream out = new FileOutputStream(file);
byte[] bytes = new b... |
3f10df70-63cf-40d7-9a50-2cc317c39e01 | 7 | @Override
public String getOOXML()
{
StringBuffer ooxml = new StringBuffer();
ooxml.append( "<a:defRPr" );
Iterator<String> i = attrs.keySet().iterator();
while( i.hasNext() )
{
String key = i.next();
String val = attrs.get( key );
ooxml.append( " " + key + "=\"" + val + "\"" );
}
ooxml.append(... |
8faceffc-fee0-423e-a1ce-c8441e971d12 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Key other = (Key) obj;
if (from == null) {
if (other.from != null)
return false;
} else if (!from.equals(other.from))
re... |
b396636c-6b52-4896-b832-6e6b478b3306 | 5 | private static DisplayMode getBestDisplayMode(GraphicsDevice device)
{
// LOOP THROUGH 32 THEN 16 THEN 8 BIT DISPLAY MODES AND SEE WHICH IS THE FIRST ONE WE CAN HANDLE
for (int x = 0, xn = MODES.length; x < xn; x++)
{
DisplayMode[] modes = device.getDisplayModes();
fo... |
ca369ad6-5480-4da9-a709-3a4042d2c741 | 2 | public ArrayList<Object> alphabeticSort(String[] words){
this.words = words;
this.nWords = words.length;
this.sortedWords = new String[this.nWords];
for(int i=0; i<this.nWords; i++)this.sortedWords[i] = this.words[i];
this.alphabeticSortIndices(words);
for(int i=0; i<... |
208b65a3-c5ea-4a8b-9464-a14feaa298aa | 7 | public void update(float dt){
totKillTime+=dt;
if(totKillTime>=killTime && killType.equals(KillType.TIMED))
main.removeBody(getBody());
if(light!=null)
light.setPosition(getPixelPosition());
if(body.getLinearVelocity().x < 0 && !isFacingLeft()) changeDirection();
else if(body.getLinearVelocity().x > 0 &... |
36bf8c65-1a03-4ac1-8b72-31b0b702b2a1 | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
MediaLibAccessor srcAccessor1 =
new MediaLibAccessor(sources[0], destRect... |
e724ac6d-03cf-4412-87b9-20f6fd83ba9a | 9 | public int editar() {
int linhasAfetadas = 0;
StringBuilder builder = new StringBuilder();
// todos os atributos
String[] atributosNome = getNomeDosAtributosDaSubClasse();
Object[] atributosValor = getValorDosAtributosDaSubClasse();
// atributos NAO PRIMARY KEY
List<String> atributosNome_NotPK = new Arr... |
8288382b-e7d8-40fc-94de-39f6ceade13e | 2 | public Type getHint() {
Type bottomHint = bottomType.getHint();
Type topHint = topType.getHint();
if (topType == tNull && bottomType.equals(bottomHint))
return bottomHint;
return topHint;
} |
a993bde1-cd10-4993-b9c0-e0a8a9819b70 | 7 | public static void main(String[] args) {
if(args.length != 1){
System.out.println("Invalid number of parameters. Application will exit.");
System.exit(0);
}
try{
WSDLDomParser wsdlParser = new WSDLDomParser(args[0]);
System.out.println("Service name: " + wsdlParser.getServiceName());
System.out.pri... |
bbdb03b6-e78f-4049-8958-00abb7e122f5 | 3 | public void closeResultSet(ResultSet rs) {
try {
if (rs != null && !rs.isClosed()) {
rs.close();
}
} catch (Exception e) {
log.log(Level.WARNING,"The following error occurred when trying to close a result set: " + e.getMessage());
}
} |
2a7f9f9f-ff17-4439-aeac-7ca0a976e96e | 8 | public void render(GUIContext container, Graphics g) {
if (lastKey != -1) {
if (input.isKeyDown(lastKey)) {
if (repeatTimer < System.currentTimeMillis()) {
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
keyPressed(lastKey, last... |
6539ba10-f647-45e8-94eb-d80ed728e329 | 7 | public static void main (String args[]) throws IOException
{
Vector dataPoints = new Vector();
String [][] numbers = new String [34602][4];
double Cordx[] =new double[34602];
double Cordy[] =new double[34602];
double Cordz[] =new double[34602];
File file = new File("1Underexpressed.csv... |
e94d652f-8a9b-486b-9716-65af9a3fda85 | 9 | @Override public Object getValueAt(int rowIn, int col) {
TopRow row = m_rows.get( rowIn);
switch( col) {
case 0: return row.m_description;
case 1: return row.m_bidSize;
case 2: return fmt( row.m_bid);
case 3: return fmt( row.m_ask);
case 4: return row.m_askSize;
case 5: return fmt( row.m_last);
... |
6c34f2ef-7f92-4aa1-8a7e-177c7ad2c5ea | 1 | public boolean action(Event e, Object o) {
if (e.target == ok) {
hide();
dispose();
}
return true;
} |
0e7e856b-0b7e-4fed-a637-df94a1e02aaf | 6 | public void onMessage(String channel, String sender,
String login, String hostname,
String message, Date calendar) {
/*sends data to Message, and onto Listener*/
ArrayList<Object> args = new ArrayList<Object>();
args.add(channel);
... |
6fdaaa13-ed20-4e66-9193-86cf5155815b | 2 | public static void closeEntityManager() {
EntityManager em = threadEntityManager.get();
if (em != null) {
EntityTransaction transaction = em.getTransaction();
if (transaction.isActive()) {
transaction.commit();
}
em.close();
threadEntityManager.set(null);
}
} |
87167cec-7719-44b9-a264-f825d3dc5c26 | 1 | public Object getElement(int index) {
if (indexWithinCapacity(index)) {
return array[index];
}
return null;
} |
9bb21554-70f3-4924-9398-e51a79e653e3 | 7 | public String generateQueryFromOWL(String category){
String query = "SELECT * FROM "+ category +" WHERE";
String priceFilter = "";
double priceLowerFilter = 0;
double priceUpperFilter = Integer.MAX_VALUE;
String typeFilter = "";
String performance = scenario.getPerformance();
String performanceFilter = ""... |
d3dbdc2b-ae0f-4bb8-962d-a5210bd498c1 | 6 | public void updateSelectedItem(INSTALL_ENUM mode)
{
for( Component component : popupMenu.getComponents() )
{
if( component instanceof JMenuItem )
{
JMenuItem item = (JMenuItem) component;
if( item.getText().contains("Nightly") )
if( mode == INSTALL_ENUM.NIGHTLY )
item.setText("<html>d... |
84d24e82-8b4e-4b35-a2ca-0e6d023d708e | 9 | int insertKeyRehash(float val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look ... |
2e202178-2789-46fe-8fd5-f87cd3eaa2c1 | 9 | public void oldChangeCombination() throws IOException{
int compLevel = compositionLevel;
int countLevel[] = initWithValueOne(compositionLevel-1);
int combinationRecBlock[] = initWithValueOne(compositionLevel);
boolean pause = false; //avoid repeating combinations
int counter = 0;
while(countLevel[0] < M... |
14d16723-a4e2-4358-afc2-996f6ab069f0 | 4 | @Override
public String[] gibTabs() {
String[] re = new String[5];
re[0] = "Punkte\n";
re[1] = "Punktlisten\n";
re[2] = "Kanten\n";
re[3] = "Flaechen\n";
re[4] = "Gesamt\n";
String[] points = QGui.pointArrayToStringArray(gibPoints());
for (int i = 0; i < points.length; i++) {
re[0] += points[i] + "... |
74f75f5d-6e8e-4cc5-b59d-63f758a7e943 | 9 | private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header) throws InterruptedException {
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null)
return;
StringTokenizer st = new StringTokenizer(inLine);
if (!st.hasMoreTokens())... |
e36db4ef-d061-40c8-8950-100425bbe8a5 | 1 | public void close() throws IOException {
if (_acceptable) {
throw new IOException("You must call the accept() method of the DccChat request before you can use it.");
}
_socket.close();
} |
fe0c5812-8cdb-46fb-a016-280259819a9c | 1 | @Override
public Object clone() {
Object ret = null;
try {
ret = super.clone();
} catch (CloneNotSupportedException e) {
}
return ret;
} |
50d1fbae-ea6e-416f-9fcb-65272f578500 | 5 | public boolean isPossibleToStart(){
if (game.getEvents().checkRequirements(game.getEvents().getFirst()) == false){
possible = false;
}
else if (game.getEvents().checkRequirements(game.getEvents().getSecond()) == false){
possible = false;
}
else if (game.getEvents().checkRequi... |
cf599bdd-9cd7-4ce3-a1cc-0a605d206002 | 5 | public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file = new File("C:/1.txt");
in = new BufferedReader(new FileReader(file));
String line, strHour, strMinute, strSec;
String subLine1;
while ((line = in.readLine()) != null) {
... |
59513f95-dc9f-4f75-b731-d669e1ba4e1b | 0 | private void boutonActionPerformed(java.awt.event.ActionEvent evt) {
selectAnimalChange(this.animaux.get(this.boutons.indexOf(evt.getSource())));
} |
ad39ba5d-6004-44e6-86f8-5c79ac1ed548 | 6 | * @param add Pass in <code>true</code> to add this column to the end of the sort order, or
* <code>false</code> to make this column the primary and only sort column.
*/
public void setSort(Column column, boolean ascending, boolean add) {
StateEdit edit = new StateEdit(mModel, SORT_UNDO_TITLE);
int c... |
d089739e-4549-47ad-8080-eccacceda640 | 4 | public void initializeMV(MaterializedView mv) {
logger.info("Find materialized view to setup, id:" + mv.getId() + ", schema:" + mv.getOriginalSchema() + ", name:" + mv.getName() + ", " +
"definition: " + mv.getDefStr());
MVContext context = initializeMVContext(mv);
if(context == ... |
e1e77bdf-596b-443d-9f8a-ea8ecdd317cd | 2 | public static String map(String... cols) {
StringBuilder sb = new StringBuilder();
for (String string : cols) {
sb.append(",`").append(string).append("`=?");
}
return cols.length > 0 ? sb.substring(1) : "";
} |
23adc030-0738-4f55-9e86-c6fdaff2bb94 | 3 | public void teleportToPlayer(ProxiedPlayer originalPlayer,
ProxiedPlayer targetPlayer) {
if (!originalPlayer.getServer().getInfo().equals(targetPlayer.getServer().getInfo())) {
plugin.teleportsPending.put(originalPlayer, targetPlayer);
originalPlayer.connect(targetPlayer.getServer().getInfo());
} else {
... |
d6b9c16b-b7f7-42ba-974a-1669d8179215 | 6 | private String calcSHA1(final File f)
{
MessageDigest hashDigester = null;
FileInputStream readFileStream;
StringBuffer sha1StringBuffer = null;
try {
hashDigester = MessageDigest.getInstance("SHA-1");
readFileStream = new FileInputStream(f);
int n = 0;
final byte[] buffer = new byte[8192];
whil... |
6a2abc9d-5e76-4a2b-a0e2-5b26b89bf910 | 5 | private ArrayList<String> constructDefaultQueries(ArrayList<String> appliedRules) {
final String DEFAULT = "Default:";
ArrayList<String> defaultQueries = new ArrayList<String>();
for (int i = 0; i < appliedRules.size(); i++){
String appliedRule = appliedRules.get(i);
if (!appliedRule.contains(DEFAULT)) {... |
803df27e-a195-4e50-869a-4450a62e7216 | 4 | public String getGridFile() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getGridFile() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getGridFile() END");
}
return GRID_FILE;
} |
c68c69c0-54c1-4d5f-ae30-e64b10fe7d7d | 2 | public void setShutdownButtonMargin(int[] margin) {
if ((margin == null) || (margin.length != 4)) {
this.buttonShutdown_Margin = UIMarginInits.SHD_BTN.getMargin();
} else {
this.buttonShutdown_Margin = margin;
}
somethingChanged();
} |
8dd07cc2-c4cf-4934-bebc-8b17ea0d7f77 | 3 | private SexFormat(boolean useSign, int dp3) {
this.useSign = useSign;
this.dp3 = dp3;
if (dp3 < 0) {
throw new IllegalArgumentException();
}
buf = new char[(useSign ? 1 : 0) + 2 + 6 + ((dp3 > 0) ? 1 : 0) + dp3];
} |
46a9694e-6867-4e85-8079-a75979e8d333 | 7 | public ArrayList<Drawable> getDrawable() {
ArrayList<Drawable> ret = new ArrayList<Drawable>();
if (fogOfWar){
if(getPlayerPlanets(getHumanPlayer()).size() == 0) return ret;
// DFS uses Stack data structure
HashSet<Planet> visited = new HashSet<Planet>();
Stack<Planet> stack = new Stack<Planet>();
stack... |
03661c78-d421-4c1b-9f30-6b845558502d | 7 | public Symbol debug_parse()
throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up ... |
ed622ca2-7979-4cfd-8a93-ad4eb0a5b235 | 7 | final void method1964(boolean bool, int i, int i_10_, int[] is, int i_11_,
byte i_12_, int i_13_, int i_14_, int i_15_) {
anInt8543++;
if (i_15_ == 0)
i_15_ = i_13_;
if (bool) {
int[] is_16_ = new int[i_13_ * i];
for (int i_17_ = 0; (i ^ 0xffffffff) < (i_17_ ^ 0xffffffff);
i_17_++) {
int i_1... |
0d194e77-7059-4f60-aa18-ae1df9823705 | 3 | public synchronized void initialise(Collection<String> stations) throws IllegalArgumentException {
stations.clear();
if(stations.size() == 0) return;
// ensure that the collection is sorted
Iterator<String> it = stations.iterator();
String a = it.next();
while(it.hasNext()) {
String b = it.next();
if(... |
9c9a028a-88e9-4ac8-9756-e2473d09f7a6 | 7 | public static void enterLogin(final LoginWindowInterface window) {
window.getPswrdField().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
Employee employee = null;
... |
26db115a-15aa-4f37-bdc1-dbc745c4fa4d | 9 | private void process(KeyEvent evt) {
if (rfb != null && rfb.inNormalProtocol) {
if (!canvas.inputEnabled) {
if ((evt.getKeyChar() == 'r' || evt.getKeyChar() == 'R')
&& evt.getID() == KeyEvent.KEY_PRESSED) {
// Request screen update.
try {
rfb.writeFramebufferUpdateRequest(0, 0,
rf... |
64ed800f-6e08-4fc2-b173-7c73866153af | 1 | @Override
public void displayConnectedPlayers(String[] players) {
playersDefaultList.removeAllElements();
for (String player : players) {
playersDefaultList.addElement(player);
}
} |
70522f60-5434-4878-80bd-c6b42641b8e2 | 9 | void formatVlenRawData(
int[] heapIxs,
Object vdata,
HBuffer fmtBuf) // output buffer
throws HdfException
{
Object[] vdataVec = (Object[]) vdata;
int nrow = vdataVec.length;
for (int irow = 0; irow < nrow; irow++) {
Object vrow = vdataVec[irow];
int ncol = -1;
if (vrow instanceof Object[])... |
ab8ccb1f-d707-45b3-a4f4-1b0eb7b2df98 | 3 | private double calculateConstrictionCoefficient() {
assert(socialConstant + cognitiveConstant >= 4 && K >= 0 && K <= 1);
double numerator = 2 * K;
double temp = socialConstant + cognitiveConstant;
double denominator = 2 - temp - Math.sqrt(temp * (temp - 4));
if(denominator < 0){
denominator = denomin... |
606b2d05-12b0-4292-a3c6-2e98b7c3ad66 | 1 | @Override
public String getFileName() {
String result;
try {
MessageDigest digest = MessageDigest.getInstance("sha-1");
digest.update(fullUrl.toUrlString().getBytes());
result = hashToString(digest.digest()).replaceAll("\\s*", "");
} catch (NoSuchAlgorithm... |
030342d9-114c-486a-8602-b8d556219d77 | 8 | public String draw(Shape shape) {
StringBuilder output = new StringBuilder();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
char pixel = ' ';
if (shape instanceof Circle) {
if (((Circle) shape).isPixelActivated(x, y)... |
87d98457-82d6-4750-a64b-ae2da3c40048 | 6 | public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) throws Exception {
this.age++;
Move m = null; // placeholder for return value
if ( this.age < 200 && !(foodleft>50) ) {
m = new Move(STAYPUT);
} else {
if ( neighbors[NORTH] == -1 ) {
m = new Move(REPRODUCE, NOR... |
46f94b43-f4f6-410a-8507-7d2d7ca4a96a | 6 | private void openImageUrl() {
String url = JOptionPane.showInputDialog(this, "Enter image URL", "http://", JOptionPane.QUESTION_MESSAGE);
if (url == null || url.trim().equals("")) {
return;
}
String imageName = getImageNameForUrl(url);
String pageName = getPageName()... |
67c49ab8-bddc-470b-9925-be9a9b25de31 | 8 | @Override
protected boolean remove(String constraint) {
String fingerprintsCnst = (constraint != null && constraint.length() > 0) ? constraint : "1=1";
String measurementsCnst = HomeFactory.getMeasurementHome().getTableIdCol() + " IN (SELECT " + HomeFactory.getFingerprintHome().getTableCols()[1] +
... |
9e59f2fe-5f20-4471-a0a3-0f5ef68faa84 | 5 | @Deprecated
public static void log(Level level, String log) {
Logger logger = LoggerFactory.getLogger("org.vizun");
if(level == Level.DEBUG) {
logger.debug(log);
} else if(level == Level.ERROR) {
logger.error(log);
} else if(level == Level.INFO) {
... |
bf838b19-d72d-43d4-abf0-d1c3efc2e3b7 | 1 | private void sleep(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
d615ebb4-a0e6-4cec-8f7f-d2090b61decd | 0 | public void setApellido1(String apellido1) {
this.apellido1 = apellido1;
} |
5d851163-e5c6-473c-96ce-af8ac97b1dee | 1 | private String buildJsonData(String username, String message) {
JsonObject jasonObject = Json.createObjectBuilder().add("message", username + ": " + message).build();
StringWriter stringwriter = new StringWriter();
try (JsonWriter jsonwriter = Json.createWriter(stringwriter)) {
jsonw... |
89407a49-981e-46df-85eb-6b39b61f094a | 6 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.kick + " (PlayerName)");
return;
}
String n... |
02c28207-43bf-48b6-b450-1c11da2dec24 | 9 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equalsIgnoreCase(ProviderElements.NAME) && provider != null) {
provider.setName(text);
} else if (qName.equalsIgnoreCase(ProviderElements.URL) && provider != null) {
provider.setFeedUrl(text);
} el... |
836d4c65-2b8a-4a9a-a293-8983e23a8b39 | 4 | public String getDataReg() throws SQLException, ClassNotFoundException {
String sts = new String();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
try {
Statement stmt ... |
44e0b73c-8b2f-4bd2-a417-1d63c1c2cfb3 | 0 | public FileReceiver(String fileName, int packageSize,
int port, int verbose) {
this.fileName = fileName;
this.packageSize = packageSize;
this.port = port;
this.verbose = verbose;
} |
163d25f2-c1a0-44f8-9d0a-d70d18bfad7f | 8 | public MediaWiki addText(final MediaWiki.EditToken editToken, final String text, final boolean atEnd, final String editSummary, final boolean bot, final Boolean minor) throws IOException, MediaWiki.MediaWikiException {
final Map<String, String> getParams = paramValuesToMap("action", "edit", "format", "xml");
final ... |
f6219601-e90b-4dfc-a8a0-2e961cdf0082 | 4 | void calculateDesiredDeltaVelocity(double duration) {
double velocityFromAcc = 0.0d;
if (body[0].getAwake())
{
Vector3d lfa = new Vector3d(body[0].getLastFrameAcceleration());
lfa.Multiply(duration);
velocityFromAcc = lfa.ScalarProduct(contactNormal);
//body[0].setLastFrameAcceleration(lfa);
... |
a8a20570-b651-4bc4-86ea-99a9f17701b2 | 4 | public static void main(String[] args) {
// 顺行起点first
State state = new FirstState();
Context ctx = new Context(state);
for (int i = 0; i < 6; i++) {
state = ctx.getState();
System.out.print(state);
if (state == null) {
break;
}
System.out.print("->");
// 顺流
ctx.nextStep();
}
Syste... |
9f2f63bf-63e9-4b87-a06c-5b70b89d5997 | 3 | private RailLogic getMinecartTrackLogic(ChunkPosition var1) {
return BlockRail.isRailBlockAt(this.worldObj, var1.x, var1.y, var1.z) ? new RailLogic(this.rail, this.worldObj, var1.x, var1.y, var1.z) : (BlockRail.isRailBlockAt(this.worldObj, var1.x, var1.y + 1, var1.z) ? new RailLogic(this.rail, this.worldObj, va... |
6822b766-1789-4f67-80d4-ea1aa08e00b5 | 3 | public void Activation(){
for(int i=0; i<inputNodes[0].brnO.length; i++)
inputNodes[0].brnO[i].rightNode().sigmoid();
Node tek= inputNodes[0].brnO[0].rightNode();
for(int j=0; j<hiddenLayersNo; j++){
for(int k=0; k<tek.brnO.length;k++){
tek.brnO[k].rightNode().sigmoid();
}
tek=tek.brnO[0].rightNod... |
df0a64a6-e629-476f-8a6b-12b490fa945a | 4 | public void keyPressed(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_LEFT){
player.setDirection(Moveable.LEFT);
key[0] = true;
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT){
player.setDirection(Moveable.RIGHT);
key[1] = true;
}
else if(e.getKeyCode() == KeyEvent.VK_UP){
player.setDir... |
ba6f157e-0b20-4c21-9c6f-e25f731d89f4 | 5 | private List<String> getRaw(String key) {
List<String> rawList = messages.getStringList(key);
String raw = messages.getString(key);
if (!rawList.isEmpty()) {
if (rawList.size() == 1 && rawList.get(0).isEmpty())
return Arrays.asList("");
return rawList;
} else if (raw != null) {
if (raw.isEmpty())
... |
c17b44ac-c706-4dde-b2c1-6834bdb23c93 | 3 | public void arrange(Container parent) {
for (int index = 0; index < parent.getComponentCount(); index++) {
Component component = parent.getComponent(index);
if (component != null && bottomCenter.contains(component)) {
component.setLocation(getBottomCenterX(parent, component), component.getY());
parent.r... |
74dab7af-70eb-4f38-a212-3222fde4cc1f | 6 | public void addRequiredCourseToDegree(int degreeId, int courseId) {
if(!isValidId(degreeId) || !isValidId(courseId)) {
return;
}
Course course = courseDao.getCourse(courseId);
Degree degree = degreeDao.getDegree(degreeId);
if(course != null && degree != null) {
for(Course c : degree.getRequire... |
aaf73ccb-cfbf-43e5-bd23-cf2cc21b92e4 | 3 | private void calculatePathTree()
{
//Platz machen für neuen Weg
Pfad.clear();
//Speichert alle Wege
Vector<Path> Pfade = null;
//Pfad berechnen
bestgoal = PathFinder.getBestGoal(Lines, Goals, position, false);
PathFinder PF = new PathFinder(Lines, position, bestgoal, pathmode);
PF.calculatePath()... |
3463502e-22e4-4f35-8f82-b6b9df66b75f | 9 | public static String stringFor_cl_device_fp_config(long n)
{
if (n == 0)
{
return "(none)";
}
String result = "";
if ((n & CL_FP_DENORM) != 0) result += "CL_FP_DENORM ";
if ((n & CL_FP_INF_NAN) != 0) result += "CL_FP_INF_NAN ";
if ((n & CL_FP_ROUND... |
1e6a3b5f-6aec-4f4f-9b3e-9f0a4afbe91c | 6 | void solveNQueensDFS(int level, int n, ArrayList<String[]> res) {
if (level == n) {
// construct one solution
String[] strs = new String[n];
for (int i = 0; i < n; ++i) {
String str = "";
for (int j = 0; j < n; ++j) {
if (board[i][j]) {
str += "Q";
} else {
str += ".";
}
... |
f9e49e6c-6d24-4c58-bd96-fab8835a80db | 0 | public void setRunning(boolean b) {
running = b;
} |
e4f63c72-fe8c-4f43-a140-5d77d6c0285b | 8 | public static String getInsertItem(String type) {
BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
String ans = "";
try
{
while ( ans.length() == 0 ) {
if(type.equals("start")){
System.out.println("1, Show the current inserts of the t... |
f0ebbc21-64f7-4a5c-925a-ffb6f48f6484 | 2 | public BufferedImage createBufferedImage(String path){
URL imgurl = getClass().getResource(path);
if(imgurl!=null){
try {
return ImageIO.read(imgurl);
} catch (IOException ex) {
System.err.println("Could not find file1: "+path);
}
... |
b5bc5f57-d059-43ff-955d-4cb7c09eaef7 | 2 | public EventModel() {
checkDate();
//Only run checkWeekend() if today or tomorrow is still valid
if (todayValid || tomorrowValid) {
checkWeekend();
}
} |
fafd54bd-c9cc-49fa-a395-e5ea695a4da4 | 7 | void writeIndent() throws IOException {
int indent;
if (this.indent != null) {
indent = this.indent;
} else {
indent = 0;
}
if (!this.indention || this.column > indent || (this.column == indent && !this.whitespace)) {
writeLineBreak(null);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.