method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b2efaf3f-b348-4b56-b97f-74534a541be5 | 5 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Room) {
Room room = (Room)obj;
if (this.id != room.id) {
if (this.id == null || !this.id.equals(room.id)) {
return fals... |
88e98257-a56b-4de1-8679-fd78b5e4be2e | 4 | public List<String> getProductNames(String proMgrName){
PreparedStatement stmt = null;
ResultSet rs = null;
List<String> proNames=null;
try {
stmt = conn
.prepareStatement("select proName from ProductInfo where productManager = ? ");
stmt.setString(1, proMgrName);
rs = stmt.executeQuer... |
18c61d11-c49e-470a-9a0c-567fb8bb0ba9 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()== this.botaoImprimir){
ArrayList<Reputacao> reputacoes = agente.getTodasReputacoes();
System.out.println("****************************");
System.out.println("Imprimindo todas as reputacoes");
System.out.println("*********************... |
d76414d5-8a2a-443f-ba13-839433ec00e0 | 5 | public void create(Bitacora bitacora) throws PreexistingEntityException, RollbackFailureException, Exception {
if (bitacora.getId() == null) {
bitacora.setId(new BitacoraId());
}
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
... |
022781c0-056c-43a7-bca4-bf3b33eb788a | 5 | public boolean getReceiveDateByBookID(IssueBookVO issueBookVO)
throws LibraryManagementException {
boolean returnValue = true;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException ... |
2ac94a43-dce0-4917-b53b-850638834235 | 7 | private static void setDefaults()
{
// variables that always must be set
if ( encoding == null )
encoding = Charset.defaultCharset().name();
if ( groupName == null )
groupName = "top level";
if ( longName == null )
longName = "version "+Short.toString(version);
if ( shortName == null )
shortName ... |
b0a2ae7a-a80e-4e92-9f4e-bd2000b9898e | 3 | public void laggTillFramfor (Punkt hornet, String hornNamn)
{
Punkt[] h = new Punkt[this.horn.length + 1];
int pos = 0;
for (int i = 0; i < this.horn.length; i++){
h[i] = this.horn[i];
if(hornNamn == this.horn[i].getNamn()){
pos = i;
h[pos] = hornet;
}
}
for(int i = pos + 1; i < this.h... |
73766543-728f-4e2f-9b74-72cae230ae57 | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
ab082cdf-ca51-4bc1-bc63-b85488b732bf | 4 | static int DFS(int r, int c, int t) {
int s = side(r, c);
for (int[] d : dir)
if (inside(r + d[0], c + d[1]) && v[r + d[0]][c + d[1]] != t && on[r + d[0]][c + d[1]]) {
v[r + d[0]][c + d[1]] = t;
s |= DFS(r + d[0], c + d[1], t);
}
return s;
} |
c40ae273-624b-48af-8ce3-821813dfe000 | 1 | public void insertarEnMedio( E pData, Nodo<E> pNodoPrevio){
if (pNodoPrevio == cabeza){
this.insertar(pData);
return;
}
Nodo<E> nuevoNodo = new Nodo<>(pData);
Nodo<E> nodoTmp = pNodoPrevio.getSiguiente();
pNodoPrevio.siguiente = nuevoNodo;
... |
21f851df-8d54-4fcf-b033-20f538bc7552 | 4 | public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... |
8590ca47-444a-4458-a518-c27b3732c49c | 8 | public static boolean search2DMatrix(int[][] matrix, int target) {
int start = 0;
int end = matrix.length-1;
int row=0;
while(start<=end)
{
int midrow = (start + end)/2;
if(target<matrix[midrow][0])
{
end = midrow-1;
}else if(target>=ma... |
07e9c7f0-7c73-4d52-acdd-c50b2ba2bd7f | 6 | private StartupContainer(final String[] args) {
boolean disableGUI = false;
for (final String param : args) {
if ((param != null) && param.equals(stone.Main.NO_GUI_ID)) {
disableGUI = true;
}
}
this.io = new IOHandler(disableGUI ? null : Main.TOOLNAME);
boolean jar_ = false;
Path workingDirectory_... |
88579cb5-b415-430f-a704-148878362267 | 6 | private String findCommonPrefix(String common, String str) {
if (common.length() == 0 || str.length() == 0) return "";
int i = 0;
while (i < common.length() && i < str.length() && common.charAt(i) == str.charAt(i)) {
i++;
}
if (i == 0) return "";
return common... |
0a8c3ecc-c218-49d7-8f0e-023569ce2adb | 2 | public static void copyRecursively(File src, File dest) throws IOException {
Assert.isTrue(src != null && (src.isDirectory() || src.isFile()), "Source File must denote a directory or file");
Assert.notNull(dest, "Destination File must not be null");
doCopyRecursively(src, dest);
} |
eb9e721a-8713-4bfc-aa10-b83eaf58cd1f | 8 | private void interpolateBones(SpriterKeyFrame firstFrame, SpriterKeyFrame secondFrame, float xOffset, float yOffset){
for (int i = 0; i < firstFrame.getBones().length; i++) {
SpriterBone bone1 = firstFrame.getBones()[i];
this.tempBones[i].setName(bone1.getName());
this.moddedBones[i].setName(bone1.getName())... |
cefd8813-1c77-45cb-b88f-6816d98ae423 | 8 | public static int[][][] readmodel(String path){
int[][][] out = new int[3][aa][windowsize];
//Letzte Zeile des Modells auf 0 setzen
try{
FileReader input = new FileReader(path);
BufferedReader br = new BufferedReader(input);
String line;
line = br.readLine();
if(line.startsWith("//")){
br.readL... |
dbb60e3e-6094-4bc0-b664-a698c999396d | 6 | private static void direct_range_search(finger_print fp, double dis,
Data data) {
ArrayList<Integer> lst1 = new ArrayList<Integer>();
HashMap<Integer, Integer> potent = new HashMap<Integer, Integer>();
ArrayList<Integer> lst2 = new ArrayList<Integer>();
// to be commented
/*for (int i : data.data_set.keyS... |
2cb01437-a941-40ed-8a3f-fe7587143ff0 | 4 | public void siguienteRegla() throws IOException
{
String antecedentes[] = new String[Ante.length];
String consecuentes[] = new String[Cons.length];
char etiqueta[] = new char[15];
for(int j = 0; j < antecedentes.length;j++)
{
for (int i = 0; i <... |
13eb57a0-b899-4096-ba35-27a41edfcaba | 8 | final public void AndExpression() throws ParseException {
Token t=null;
EqualityExpression();
label_11:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BIT_AND:
case BIT_ANDX:
;
break;
default:
break label_11;
}
switch ((jj_ntk==-1)?j... |
34017e96-78cb-404c-84b9-753268bdd7b6 | 6 | public void test_15_DnaCoder_copy_1() {
DnaCoder dnaCoder = DnaCoder.get();
// Rand
long seed = 20100809;
Random rand = new Random(seed);
int numTests = 10000;
int maxLen = 1000;
for( int i = 1; i < numTests; i++ ) {
int seqlen = rand.nextInt(maxLen) + 10;
String srcStr = randSeq(seqlen, rand);
... |
ce5f1a3b-1859-4e20-b48d-347554c894ce | 6 | public void cargarListaBorrar(){
try{
r_con.Connection();
String puntoVenta=combo_pto_venta.getSelectedItem().toString();
ResultSet rs=r_con.Consultar("select tc_codigo,tc_descripcion,vxc_numero "
+ "... |
957e7dd3-813e-4f08-87e3-65f5e2f95e05 | 9 | @Override
public boolean equals(Object obj) {
// generated
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Measurement other = (Measurement) obj;
if (temperature == null) {
if (other.temperature != null)
return false;
} else if ... |
5ac357f0-bbdf-40aa-b734-6d992ef3f047 | 1 | public GameHistory() {
history = new Field[MAX_NUMBER_OF_STEPS];
for (int i = 0; i < MAX_NUMBER_OF_STEPS; i++){
history[i] = new Field();
history[i].emptyField();
}
} |
59e96f58-5b73-42ee-b7b7-9b8292d3fd16 | 7 | private static void detectFirstCycle(ArrayList<Integer> numSeq){
int length = numSeq.size();
ArrayList<Integer> subSeq = new ArrayList<Integer>();
subSeq.add(numSeq.get(0));
int size = 1;
for(int i = 1; i<length; i++){
for(int j=0; j<size; j++){
if(subSeq.get(j)==numSeq.get(i)){
int k = j;
in... |
4b2aaab1-199e-4669-945b-ea4ec59f12c7 | 1 | @Override
public void update(long deltaMs) {
if(ai != null) {
ai.update(deltaMs);
}
} |
111f3aaf-998e-4da2-a4ac-1b90a5c1a555 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof AgencyAndId))
return false;
AgencyAndId other = (AgencyAndId) obj;
if (!agencyId.equals(other.agencyId))
... |
438a7a2f-df51-4208-89af-c4acf6455489 | 1 | public treeNode getNextInsertParent() {
treeNode parent = this.lastInsertNode.parent;
// last insert is right child of parent
// scenario 1锛�current node is not the right most on its level, then
// parent's next right sibling's left child is the next spot to insert
if (!isRightMost(this.lastInsertNode)) {
... |
3372cc41-ad4b-406d-8524-f50a6f635a54 | 0 | public int getType() {
return type;
} |
b216362a-709b-4f13-a608-7d261730bbe7 | 8 | private ArcDef createArcDef() {
ConsolFun consolFun = (ConsolFun) consolFunCombo.getSelectedItem();
double xff;
try {
xff = Double.parseDouble(xffField.getText());
if (xff < 0 || xff >= 1D) {
throw new NumberFormatException();
}
}
... |
1a9e363b-f5ce-44fe-80d1-544767c15b5a | 2 | public String getTypeAlias(String typeSig) {
String alias = (String) aliasesHash.get(typeSig);
if (alias == null) {
StringBuffer newSig = new StringBuffer();
int index = 0, nextindex;
while ((nextindex = typeSig.indexOf('L', index)) != -1) {
newSig.append(typeSig.substring(index, nextindex + 1));
i... |
7addf91e-bbea-479c-b957-63a774b99faf | 7 | final void method624(int i, int i_195_, int i_196_, int i_197_) {
anInt5534++;
for (int i_198_ = 0; anInt5632 > i_198_; i_198_++) {
int i_199_ = 0xffff & aShortArray5580[i_198_];
int i_200_ = (i_199_ & 0xfd9e) >> 1107300586;
int i_201_ = i_199_ >> -942433721 & 0x7;
if ((i ^ 0xffffffff) != 0)
i_2... |
74dfe591-8d42-4e50-8bc5-d5fdc832db69 | 9 | private void lsSort (final int ISA, final int n, final int depth) {
final int[] SA = this.SA;
int ISAd;
int first, last, i;
int t, skip;
for (ISAd = ISA + depth; -n < SA[0]; ISAd += (ISAd - ISA)) {
first = 0;
skip = 0;
do {
if ((t = SA[first]) < 0) {
first -= t;
skip += t;
} else... |
4d42e3a8-52db-481c-9524-4fd3d40370ef | 6 | @Override
public boolean activate() {
return (Constants.BEAR_AREA.contains(Players.getLocal())
&& !Inventory.isFull() && !Widgets.get(13, 0).isOnScreen()
&& !isTalking() && !isAnswering() && !isListening() && !Settings.noob
);
} |
7702a7d1-335e-4c0f-a77e-7df51e20f207 | 6 | public void close() {
if (USE_INTERNET) {
try {
AddressProvider.disconnect();
} catch (MalformedURLException ex) {
System.err.println("Could not discconnect correctly... MalformedURLException.");
} catch (IOException ex) {
Syst... |
13b34040-a5a0-4d64-9ea5-30ed2560096b | 2 | public boolean setOptionsbarHeight(int height) {
boolean ret = true;
if (height < 0) {
this.optionsbar_Height = UISizeInits.OPTIONSBAR.getHeight();
ret = false;
} else {
if (height > UISizeInits.OPTIONSBAR.getHeight()) {
this.wrapBtnAccInNewE... |
991fefa8-274b-4015-bc39-a22ab5d75578 | 5 | @Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream()))))
{
TableRow row = new TableRow ();
... |
24ac265a-5cb7-4cb5-825d-d1056343140e | 2 | @Override
public void advanceMinute() {
for(int i = 0; i < cashiers; i++){
lines[i].get(0).servedMinute();
if(lines[i].get(0).getExpectedServiceTime() <= 0){
lines[i].remove(lines[i].get(0));
}
}
} |
2d63d0e3-9b70-4c73-bbee-5c22c59261ab | 3 | @Override
public void setValueAt(Object value, int row, int column) {
// Get the selected Pair
final Pair<Boolean, String> selected = data.get(row);
// Mark the sync status on the actual object
folderLoop: for (final FolderConfig folderConfig : GuiUtils.syncConfig.getConfigs()) {
for (final SongConfig songC... |
acb1234f-5cb4-40f9-a75b-213d2379f133 | 8 | private BitSet selectRBonds(String str) {
int n = model.rBonds.size();
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
synchronized (model.rBonds) {
for (int i = 0; i < n; i++) {
if (model.getRBond(i).isSelected())
bs.set(i);
}
}
return ... |
98fc644f-0908-4afa-9adf-e00efae232c4 | 4 | public void read(String filename) throws FileNotFoundException, IOException {
String curRow[];
BufferedReader file = new BufferedReader(new FileReader(filename));
try {
int n = Integer.valueOf(file.readLine());
L = new int[n][n];
for (int i = 0; i < n; i++) {
curRow = file.readLine().split(delim);... |
ac599c78-9980-450b-9230-07e48acddf88 | 3 | private MessungInfo lookupMessung(int station_id, Date date) throws SQLException
{
try
{
MessungInfo messung = new MessungInfo();
ResultSet setMinDate = connection.query(
"select *" +
"from dbsp_wettermessung\n" +
"where station_id = " + station_id + "\n" +
"order by datum ASC\n" +
"limit... |
46745f1e-d946-40c6-9021-605fee6be1fc | 2 | private static String[][] parseCSV(String text) {
Logger.log("Starting parsing on text:\n" + text);
String[] lines = text.split("\n");
ArrayList<String[]> array = new ArrayList<>();
for (String line : lines) {
array.add(line.split(","));
}
String[][] out = new String[array.size()][array.get(0).length];
... |
d3ead3f5-4ab5-4583-819a-4a1fa9d91c12 | 7 | public static List<Cromossomo> roleta(List<Cromossomo> cromossomos, int nElementos) {
int dimensao = cromossomos.size();
double fitnessTotal = 0;
double[] fitness = new double[dimensao];
//pegar o primeiro fitness como menor temporariamente
double menorFitness = 1 / cromossomos.... |
b78435d8-ad1b-4c03-a384-9b5f16a66d44 | 0 | public void set(Object t) {
this.t = t;
} |
a8d189d6-c1d0-4be1-b5b6-41f29e3bb79b | 8 | @Override
public void readAssemblyFile() {
String line;
Scanner s = null;
boolean leadingCommentsFinished = false; //To signal end of any leading comments
try {
s = new Scanner(new BufferedReader(new FileReader(fileReference)));
while (s.hasNextLine()) {
line = s.nex... |
83d452d1-fdc4-4b41-8cb2-8870071e3e9b | 6 | @Override
public void update(Observable o, Object arg) {
ServerModel model = presenter.getClientModel().getServerModel();
Player player = model.getPlayerByID(presenter.getPlayerInfo().getID());
getView().setElementAmount(ResourceBarElement.BRICK, player.getBrick());
getView().setElementAmount(ResourceBarElemen... |
0e9791cc-252b-4138-b6b1-2e8f0f344276 | 9 | public static void loadResources()
{
log.info("loading resources...");
// load servericon
final String iconPath = "server-icon.png";
final File serverIcon = new File(iconPath);
if (!serverIcon.exists())
{
log.warning("icon file '" + iconPath + "' not foun... |
29cdd769-ed26-42f9-b2f4-47cef9a781c7 | 4 | @Override
public void replaceArgument(Value replace, Value i, boolean throwOnError)
throws Exception {
boolean found = false;
if(arg1.equals(replace)) {
arg1 = i;
found = true;
}
if(arg2.equals(replace)) {
arg2 = i;
found = true... |
9135c809-c015-4e32-b9ef-f35b15a32ec0 | 2 | public boolean portsAreValid(){
if(reciever == null || sender == null){
return false;
}
return true;
} |
d4e44ec4-8169-4692-9511-7bebafbac8ce | 6 | public void updateWantedGoods() {
List<GoodsType> goodsTypes = new ArrayList<GoodsType>(getSpecification().getGoodsTypeList());
Collections.sort(goodsTypes, wantedGoodsComparator);
int wantedIndex = 0;
for (GoodsType goodsType : goodsTypes) {
// The natives do not trade milit... |
666d4a8b-284f-42e9-8d96-cdd405fecd4e | 4 | public boolean dropTetrominoe(){
for(int x=emplacement.getNombreColonne()-1 ; x>=0 ; x--)
for(int y=emplacement.getNombreRangee()-1 ; y>=0 ; y--)
if(!emplacement.IsEmpty(x, y))
try{
emplacement.setCoordonee(x, y, false);
... |
fbdf0fac-60d8-4371-8d88-0584b57a3491 | 9 | private JPanel getPanCodes() {
if (panCodes == null) {
panCodes = new JPanel();
panCodes.setLayout(new BoxLayout(getPanCodes(), BoxLayout.Y_AXIS));
ButtonGroup group=new ButtonGroup();
for(int i=0;i<Interface.CODES.values().length;i++) {
final int t=i;
JRadioButton temp=new JRadioButton(Interface.... |
db57b6c0-e956-4288-a0e6-703932bfef2b | 3 | public Double getLoyalty(String playerName) {
if (loyaltyCache.containsKey(playerName))
return loyaltyCache.get(playerName);
Double loyalty = Config.leadershipSkillDefault;
String SQL = "SELECT `loyalty` FROM " + tblSkills + " WHERE `player` = ? AND `leadership` IS NOT NULL";
Connection con = getSQLConnect... |
af62ea6f-7f9e-421a-8af3-0dd11f766272 | 8 | public void run(){
Scanner uScan;
String sMsg;
String sStatus = "";
String sPrevStatus = "";
while(true){
//Check to see if the player is in an active game:
uScan = new Scanner(Client.sendMsg("GET_PLAYER_STATUS"));
uScan.next();
sStatus = uScan.next();
if(sStatus.equals("ACTIVE") ... |
fe8d638b-4bf9-4af6-8595-c61f15c2b2c5 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TClassout other = (TClassout) obj;
if (!Objects.equals(this.kodeClass, other.kodeClass)) {
re... |
8fdf4948-56d4-438a-8ab5-965d7a3ff0cc | 8 | public CompiledExpression compileExpression(String expressionDefinition)
throws CompilationException
{
Syntax syntax = getSyntax();
String whiteSpaces = syntax.getWhiteSpaceCharacters() != null ? syntax
.getWhiteSpaceCharacters() : "";
StringTokenizer rechStr = ne... |
3f4999eb-caf2-4c48-9b2b-20ba9f13015e | 5 | public static void main(String[] args) throws Exception
{
/*
gdb.addNode("regionName", null,null);
gdb.addNode("regionName", "agentName",null);
gdb.addNode("regionName", "agentName","pluginName");
gdb.addNode("regionName", "agentName","pluginName2");
gdb.addNode("regionName", "agentName2",null);
gdb.... |
a8279845-458c-4ac7-af61-0bac7f71b4e2 | 0 | public static void stop(long uid) {
UserNotificationBuffer buffer = getMonitorFor(uid);
buffer.stopNotification();
} |
f5f749f4-ec3f-4aa0-a3e4-9abf4fac72a8 | 8 | @Override
public String process(HttpServletRequest request)
throws MissingRequiredParameter {
ResultSet resultSet = null;
String email = request.getParameter("email");
if (email == null) {
throw new MissingRequiredParameter();
}
String result = null;
try {
connection = dataSource.getConnection();... |
c4b2103a-37aa-44c5-b4a3-8a10a3550b3b | 5 | @Override
public void paint(Graphics2D g, int width, int height) {
double dividerPercentage = getCaseWidth(g) / (double) getLabelledWidth(g);
int divider = (int) (width * dividerPercentage);
int titleHeight = getTitleHeight(g);
g.drawRect(0, 0, width, height);
g.drawLine(0, 0, divider, titleHeight);
g.draw... |
4f10161d-3912-4f15-8ee5-cfae422303f3 | 0 | public String getUrl() {
return url;
} |
797788a4-56b9-43ce-bdce-1a2f4d6fed9b | 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... |
c93be90f-fc02-428a-8526-52f1b327edca | 7 | private boolean r_more_than_one_syllable_word() {
int v_1;
int v_3;
// (, line 445
// test, line 446
v_1 = cursor;
// (, line 446
// atleast, line 446
{
... |
1825b3ea-8dc6-4bb1-93a5-626bb660e348 | 3 | public int hashCode() {
int hash = 7;
hash = 31 * hash + (this.groupId != null ? this.groupId.hashCode() : 0);
hash = 31 * hash + (this.artifactId != null ? this.artifactId.hashCode() : 0);
// ignore type
hash = 31 * hash + (this.version != null ? this.version.hashCode() : 0);
... |
aae030aa-24c9-4c64-983c-c9b125d88f77 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
ef77aee6-36e7-4dbc-8766-17ef5f7b101d | 5 | @SuppressWarnings("unused")
public void run() {
Socket s2;
try {
s2 = new Socket("localhost",
InitiationDispatcher.LOGGING_SERVER_CONNECTION_PORT);
LogManager.getLogger(Lab6Test1.class).log(Level.DEBUG,
"connected: {}, addr: {}, remote... |
125c9500-fa10-4c55-a4e6-3b5201a084ea | 3 | public void setCheckboxIcons( JCheckBox box, String baseImagePath ) {
InputStream stream = null;
try {
stream = DataManager.get().getResourceInputStream(baseImagePath);
Image scaled = getScaledImage(stream);
int scaledYoffset = (maxIconHeight-scaled.getHeight(null))/2;
BufferedImage unlocked = new Buffe... |
e468f67a-e8e1-4b3b-959a-89db3952b8f0 | 5 | private void StartRide() {
V10Dragon d = null;
for (Entity e : player.getNearbyEntities(20, 20, 20)) {
if (!(e instanceof EnderDragon)) {
continue;
}
EntityEnderDragon eed = ((CraftEnderDragon) e).getHandle();
if (eed instanceof V10Dragon) ... |
7d6f0420-ead7-43c8-9c9e-2b4c55885fd7 | 3 | public StringBuffer format(final CommandSender target) {
// format all dates with time zone for target
TimeZone timeZone = null;
final Format[] formats = this.getFormatsByArgumentIndex();
for(int i = 0; i < formats.length; i++) {
if (!(formats[i] instanceof DateFormat)) conti... |
fc665a41-977f-4b61-ad1f-bd149860f49b | 2 | public static void main(String args[]) {
long begin = System.currentTimeMillis();
int total = 338614;
int limit = 22574;
ExecutorService executorService = Executors.newFixedThreadPool(total
/ limit);
for (int i = 0; i <= total / limit; i++) {
executorService.execute(new SetCitedIDList(i * limit, limit)... |
4e9e2cf0-fff2-453e-bfa7-ec68f480e830 | 4 | public static String replace(String inString, String oldPattern, String newPattern) {
if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) {
return inString;
}
StringBuffer stringBuffer = new StringBuffer();
int pos = 0;
int index = inString.indexOf(oldPattern);
int patLen = oldPatte... |
8ab322db-3127-4309-9500-2decbc9d7c37 | 9 | @Override
public void sampleOccurred(SampleEvent e) {
if (e.getResult().isSuccessful()){
if (isErrorsOnly()){
return;
}
} else {
if (isSuccessOnly()){
return;
}
}
JMeterVariables variables = JMeterContextService.getCont... |
37864ae9-785b-419f-8406-882ced543a52 | 9 | @Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (debug) {
log("LoginFilter:doFilter()");
}
doBeforeProcessing(request, response);
HttpServletRequest serv... |
fd640a07-c422-4553-bb93-26a7a2ed2702 | 7 | private List<File> getMinifyFiles(List<File> filesToMinify, List<File> outFiles) {
if (outFiles != null && outFiles.size() > 0) {
getLog().info("About to exclude the following files: " + FileUtilities
.getCommaSeparatedListOfFileNames(outFiles));
List<File> filesToMinifyMinusDestFile = Lists... |
2e02f2a8-2c2f-44fa-85d2-6288a9ed3131 | 1 | public static void clearTable(PatientProfilePage profileP){
int rows= profileP.getPrescriptionHistory().getRowCount();
int i=0;
while(i<rows){
profileP.getPrescriptionHistory().setValueAt("",i,0);
profileP.getPrescriptionHistory().setValueAt("",i,1);
profileP.getPrescriptionHistory().setValueAt("",i,2);
... |
67ec53e8-4efb-46fe-8ad4-509a3a720151 | 2 | private void readAndSetCards() throws IOException {
//reset cards if there are any
cardList.clear();
String line;
//read in the cards for the answer
for (int cardRow = 0; cardRow < 4; cardRow++) {
line = reader.readLine();
String[] temp = line.split(" ");
... |
0eb2cc3e-9a06-403a-b819-962499f711f9 | 3 | public static boolean isDiffChar(String a, String b) {
int diff = 0;
for (int i = 0; i < a.length(); i++) {
if (a.charAt(i) != b.charAt(i)) {
diff++;
if (diff >= 2) return false;
}
}
return diff == 1;
} |
c5295cca-8e90-4f06-9000-bf705de6ff87 | 8 | @Override
public double predict(int userID, int itemID) {
double prediction = 0;
if (data.getAverageUserRatings().get(userID) != null) {
prediction = data.getAverageUserRatings().get(userID);
}
ArrayList<Double> similaritiesList = new ArrayList<Double>();
ArrayList<Double> ratingsList = new ArrayList<D... |
24cae4ad-8140-46c2-8a61-6899bab656bc | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
54b4c9f6-1fad-487b-bf04-c6f73c74a8e1 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length >= 1) {
if(args[0].equals("sell") || args[0].equals("s")) {
return plugin.com_sell.onCommand(sender, command, label, ArrayManip.arraySub(args, 1));
} else if(args[0].equals("sellagain") |... |
e848907f-2247-49c9-8dd7-64ed8b2c9632 | 7 | private float[] calcOrbit(int i, int depth, int color) {
double xf, yf, a, b, aa, bb;
int iter = 0;
xf = smart_random_points[color][i][0];
yf = smart_random_points[color][i][1];
a = 2 * (xf - 0.5f);
b = 2 * (yf - 0.5f);
aa = a;
bb = b;
Complex z = new Complex(aa, bb);
Complex old = new Complex(z.... |
78b1dddf-f078-4d6f-bfb0-77bf7220c389 | 8 | Pair toPair( HashMap<Arc,Pair> parents, HashMap<Arc,Pair> orphans )
throws MVDException
{
if ( versions.nextSetBit(0)==0)
throw new MVDException("Ooops! hint detected!");
Pair p = new Pair( versions, data );
if ( this.parent != null )
{
// we're a child - find our parent
Pair q = parents.get( paren... |
956963bc-c492-42dc-9c1f-acb46d28e524 | 4 | public void testSafeMultiplyLongInt() {
assertEquals(0L, FieldUtils.safeMultiply(0L, 0));
assertEquals(1L, FieldUtils.safeMultiply(1L, 1));
assertEquals(3L, FieldUtils.safeMultiply(1L, 3));
assertEquals(3L, FieldUtils.safeMultiply(3L, 1));
assertEquals(6L, Field... |
0235ddd1-e46a-43ba-bc39-8b5fe93d583c | 1 | private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
try {
// TODO add your handling code here:
saveMetaRecords();
}
catch (IOException ex) {
Logger.getLogger(VAuthor.class.getName()).log(Level.SEVERE, null,... |
cbee42a4-5291-4fd6-9840-468e6f02bc11 | 1 | public boolean addRoom(String name){
if (chatRooms.get(name.toLowerCase())!=null) return false;
ChatServerChatRoom room = new ChatServerChatRoom(name, chatRooms.size());
chatRooms.put(name.toLowerCase(), room);
System.out.println("New room added: "+name);
return true;
} |
dde92b36-ad33-407f-82f0-9948b880d08d | 5 | public synchronized void actionPerformed(ActionEvent e){
File[] filePath = new File[4];
filePath[0] = new File("./ExampleText/tree.txt");
filePath[1] = new File("./ExampleText/forest.txt");
filePath[2] = new File("./ExampleText/semilattice.txt");
filePath[3] = null;
... |
8bd04ce6-5a16-45bd-9648-912a9f7de50b | 8 | public static List<Integer> getKNearestMovies(int k, int index)
{
SparseVector base = colMatrix.get(index);
List<Integer> nearestIndices = new ArrayList<Integer>();
List<Double> nearestScores = new ArrayList<Double>();
for (int i=0; i<colMatrix.size(); i++){
if (i == index) continue;
doubl... |
34d8fe02-f14f-404a-b3a1-bdcb401b972e | 3 | public static void walkOldStyle(File file) {
System.out.println(file.getPath());
if (file.isFile()) {
return; // leaf element
}
File[] subs = file.listFiles(); // directory
if (subs == null) {
return;
}
for (File subDir : subs) { // go ... |
1d7c26f2-6fa2-48ea-984e-e18420b3dca6 | 9 | public static double chiVal(double [][] matrix, boolean useYates) {
int df, nrows, ncols, row, col;
double[] rtotal, ctotal;
double expect = 0, chival = 0, n = 0;
boolean yates = true;
nrows = matrix.length;
ncols = matrix[0].length;
rtotal = new double [nrows];
ctotal = new do... |
b440ebf2-bfb4-4994-8c30-fd8d6b2d9441 | 4 | public void run() {
while(isRefreshing) {
if(!OptionsManager.getInstance().isRefresh()) {
isRefreshing = false;
refreshView();
}
long timePassed = (new Date()).getTime() - lastRefresh.getTime();
fps = (timePassed==0)?0:(1000/timePassed);
refreshView();
lastRefresh = new Date();
... |
39c73d3e-5b7a-49b7-9355-36df99d13de9 | 7 | public int[] twoSum(int[] numbers, int target) {
int[] numbers2 = Arrays.copyOf(numbers, numbers.length);
Arrays.sort(numbers2);
int start = 0;
int end = numbers2.length - 1;
while (start < end) {
int sum = numbers2[start] + numbers2[end];
if (sum == targ... |
2322715e-ea9f-4b4a-9e31-ab6a387990a9 | 7 | protected int widestDim(double[][] nodeRanges, double[][] universe) {
final int classIdx = m_Instances.classIndex();
double widest = 0.0;
int w = -1;
if (m_NormalizeDimWidths) {
for (int i = 0; i < nodeRanges.length; i++) {
double newWidest = nodeRanges[i][m_DistanceFunction.R_WIDTH] /
un... |
6f488b45-1b55-40bc-a40e-b0f7f421f059 | 9 | public void updatePosition() {
if (xPos < xDestination)
xPos += 1;
else if (xPos > xDestination)
xPos -= 1;
if (yPos < yDestination)
yPos += 1;
else if (yPos > yDestination)
... |
945db0f8-5b6f-441a-b506-505761f09f53 | 8 | public Matrix solve (Matrix B) {
if (B.getRowDimension() != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
do... |
81abd821-2cad-46a4-8aac-e1bb5fa9f310 | 7 | public static Instances clusterInstances(Instances data) {
XMeans xmeans = new XMeans();
Remove filter = new Remove();
Instances dataClusterer = null;
if (data == null) {
throw new NullPointerException("Data is null at clusteredInstances method");
}
//Get the ... |
cfce7af3-8bab-403e-a9a6-da863ba1b1b5 | 0 | protected void interrupted() {
end();
} |
046596a3-05d2-48b4-82a3-23135c3eb1c4 | 4 | @Override
public void tick()
{
xo = x;
yo = y;
zo = z;
yd -= 0.04F;
move(xd, yd, zd);
xd *= 0.98F;
yd *= 0.98F;
zd *= 0.98F;
if(onGround)
{
xd *= 0.7F;
zd *= 0.7F;
yd *= -0.5F;
}
if(!defused)
{
if(life-- > 0)
{
SmokeParticle smokeParticle = new SmokeParticle(level, x,... |
0660b6b1-477f-4f8b-9f5b-f61565befbf5 | 1 | public int queueLengthIter(){
Patient temp = this;
int count = 0;
while (temp != null){
temp = temp.nextPatient;
count++;
}
return count;
} |
9caedf57-aca2-4f68-ba33-76384a7c8690 | 3 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (!Commands.isPlayer(sender)) return false;
if (args.length != 1) return false;
Player p = (Player) sender;
ConfigurationSection cs = ChannelsConfig.getChannels().getConfigurationSection("channe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.