method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
10dbda97-e417-42a2-8133-a10941b0db8e | 0 | public void setName(String name) {
this.name = name;
getAutomaton()
.distributeStateEvent(
new AutomataStateEvent(getAutomaton(), this, false,
false, true));
} |
5386b7e9-904b-4f29-add7-5112da716f9f | 6 | private void loadImageFilenames() {
String fileEndings[] = {"JPEG","JPG","jpeg","jpg","png","PNG"};
File images = new File(sdir);
ArrayList<String> imgArray = new ArrayList<String>();
for(String name : images.list()) {
if(name.split("\\.").length > 1) {
... |
c97c44e3-15d2-4f2f-9869-aef0800777d9 | 1 | public static String addHash(String channel)
{
if (!channel.substring(0,1).equals("#"))
return "#" + channel;
return channel;
} |
e44f4be6-bfc0-46b6-a6aa-c26d7aa555aa | 7 | private boolean isThreeOfkind(){
int cnt=0,rID=0,sID=0;
boolean first=true;
for (int i = 0; i < crds.size()-1; i++) {
rID=crds.get(i).getRankID();
if(crds.get(i).getRankID()==crds.get(i+1).getRankID()){
System.out.println("matched "+crds.get(i+1).getRankID() );
if(sID!=crds.get(i).getRankID()){
... |
aebf333c-b360-4775-9a97-6664ff3f3fc5 | 5 | public Batch <Coord> allNear(
final World world, final Target t, final float radius
) {
final Batch <Coord> near = new Batch <Coord> () ;
final Vec3D tP = t.position(null) ;
class Bound extends Box2D { float proximity ; }
final Bound first = new Bound() ;
first.set(-0.5f, -0.5f, size, size) ;
... |
a239fc1e-da20-4c38-8e48-f12840be4af2 | 0 | @Test
public void testCompareStrings()
{
assertTrue(true);
} |
cfaadf62-6995-41d8-8189-d3ac8d15190c | 3 | public void loadAttributes( String directory ){
BufferedReader r;
try {
File f = new File(directory + DEFAULT_ATTRIBUTES_FILE);
groups.clear();
if( f.exists() ){
r = new BufferedReader(
new FileReader(f));
Gson g = new Gson();
JsonParser p = new JsonParser();
JsonArray arr = p.p... |
99640c0d-6f3a-455b-b0e4-1b5e3dd1843b | 4 | private void btnSwitchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSwitchActionPerformed
LibrosCRUD newl = new LibrosCRUD(MyConnection.getConnection());
if(btnSwitch.getText().equals("Actualizar")){
Libros l = new Libros(
edtCodigo.getText().toString(... |
1157ae75-e2a6-48bc-8465-458386b46740 | 5 | public EvaluationResult evaluate(List inputs, EvaluationCtx context) {
// Evaluate the arguments
AttributeValue [] argValues = new AttributeValue[inputs.size()];
EvaluationResult result = evalArgs(inputs, context, argValues);
if (result != null)
return result;
... |
6e5a7d14-f8d0-4520-85bb-e8804cd89035 | 8 | @Override
public ElementHandler createHandler(String name) {
if ("diffuse".equals(name)) {
return new VectorBuilder(parentContext, new FinishCallback<Vector3>() {
@Override
public void handle(Vector3 value) {
MaterialBuilder.this.diffuse = val... |
5d68af41-c827-4cb4-bd6c-7d33b09ef46f | 4 | public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
if (!exp1.getType(st).equals("int")
&& !exp1.getType(st).equals("decimal")) {
Main.error("type error in mod!");
}
if (!exp2.getType(st).equals("int")
&& !exp2.getType(st).equal... |
97e8136f-6817-4d72-a7fe-378650c72ef1 | 0 | public LLParseDerivationController(Grammar grammar,
GrammarEnvironment environment, FirstFollowTable firstFollow,
LLParseTablePane parseTable, JLabel directions) {
this.environment = environment;
this.firstFollow = firstFollow;
this.parseTable = parseTable;
this.directions = directions;
this.grammar = g... |
276b139c-a25d-4f00-846f-9e46b0dda255 | 4 | public boolean canLightningStrikeAt(int var1, int var2, int var3) {
if (!this.isRaining()) {
return false;
} else if (!this.canBlockSeeTheSky(var1, var2, var3)) {
return false;
} else if (this.getTopSolidOrLiquidBlock(var1, var3) > var2) {
return false;
... |
639e4a40-2c97-48a6-9f7d-c72d4b70fcf5 | 4 | private void execute_stage(){
switch(current_instruction.get_format()){
case 4:
write_back_value = pc;
write_to_pc(current_instruction.get_immediate_value());
break;
case 5:
write_to_pc(current_instruction.get_rs());
break;
case 3:
alu_result = logic_unit.execute(current_instruction);
Syste... |
abbce047-f5b8-4b8e-8e3f-6fc0e61e16b3 | 5 | public void setElementConditionToAll(AbstractElement e, Condition c) {
if (e == null)
throw new NullPointerException("The element is null.");
if (c == null)
throw new NullPointerException("The condition is null.");
RETW(defaultEngineLock, () -> {
elementCondit... |
9180d8e2-0f28-487d-90f3-a62d209095ca | 3 | public void setColumnWidths(Options p){
if (name == "") return;
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
int colCount = getColumnCount();
for (int i=0; i<colCount; i++){
String key = ""+name+i;
int k = p.getIProperty(key);
if (k != 0)
getColumnModel().getColumn(i).setPreferredWidth(k);
}
setA... |
21bf2414-4a42-4907-b345-4227b49be5c6 | 8 | @Override
public void paint(Graphics g){
super.paint(g);
final Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
//g2d.drawImage(fondo, 0, 0, (int)getSize().getWidth(), (int)getSize().getHeight(),null);
... |
dc126d58-db95-4534-9536-6559b667adea | 0 | public ImageProcessor getImg(){
return origImg;
} |
081bcec2-3d09-4a84-9c48-fa6d578d6422 | 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(Boolean.TRUE) ... |
dbdf4bdf-8e24-4aae-8485-36272e3418ed | 1 | public void addFlyUp(String message) {
flyups.add(new FlyUp(message));
while(flyups.size() > 5) {
flyups.remove(0);
}
repositionFlyUps();
} |
16de66eb-f18c-4960-98ab-6ff6fceb599a | 5 | public void setStatement(Integer i, PreparedStatement stmt, Object stuff) throws SQLException {
switch (this.s_to_int(this.campos[i][1])) {
case 0:
stmt.setInt(i, (Integer) stuff);
break;
case 1:
stmt.setString(i, (S... |
38647469-2612-4131-9c2f-7f76b47b7a65 | 4 | public void setNames(SnakeServerMessage SSM) {
for (int i = 0; i < SSM.Players.length; i++) {
String name = SSM.Players[i].PlayerName;
if (name.length() < 2) {
name = "Nils " + i;
}
if (name.length() < 5) {
name += " ";
}
if (name.length() > 8) {
name = name.substring(0, 7);
}
... |
e96c4be6-4bde-4aa1-aa42-a0120523bc78 | 0 | public MeasureKitFloat(DataStructures inData) {
this.inData = inData;
outData = new DataArrays<Float[]>();
} |
80faba01-6d93-466a-80c8-c2b5bde0a487 | 8 | public Ca7Parser(String file, String nameProject, String contactDSA, String desc){
String[] infos = new String[3];
infos[0] = nameProject;
infos[1] = contactDSA;
infos[2] = desc;
InputStream flux;
try {
flux = new FileInputStream(file);
InputStreamReader lecture=new InputStreamReader(flux);
B... |
c67d4cf2-5a29-46f0-b7f6-4ed4cb9b1542 | 8 | public void searchForFood(FoodEntity other, int delta)
{
if(other.getX() >= this.getX())
{
if(hasMutated == false)
{
setDir(1);
}else if(hasMutated == true)
{
setDir(3);
}
posX+= getSpeed() * delt... |
08df144c-d7b8-4e3f-8de6-d0c8742f854f | 2 | @Test
public void testGetCharacterDirection() {
for (Direction dir : Direction.values()){
try {
testTile.getCharacter(dir);
fail("IllegalArgumentException was expected");
}
catch (IllegalArgumentException e){
//this exception was expected
}
}
} |
93d33521-3363-41e7-9f3c-364fd4926450 | 4 | public void mouseMoved(MouseEvent e)
{
lastX = e.getX();
lastY = e.getY();
System.out.println("Mouse moving starting at (" + lastX + "," + lastY + ")");
Set<Map.Entry<String, Location>> rtsTupleSet = points.entrySet();
int change = 0;
for(Map.Entry m: rtsTupleSet)
if (covers(... |
bc61243f-1b0f-4bf3-b15e-7eaf107d9f8b | 4 | public void init(GL2 gl){
//QuadTree Testing
Quadtree Q = new Quadtree(2);
Q.init();
//add in a point
try{
//Q.InsertData(Q.Root, 0.5f,0.5f,0.5f);
}
catch(Exception e){
System.out.println(e);
}
Q.getTriangles(Q.Root);
Triangles = new Triangle[Q.Triangles.size()];
for(int i = 0... |
ca206490-a846-499c-803a-4a4f64a71528 | 3 | private void handleStatus(Channel channel, ByteBuf byteBuf) {
if (!byteBuf.isReadable())
return;
int length = ByteBufUtils.readVarInt(byteBuf);
int opcode = ByteBufUtils.readVarInt(byteBuf);
if (opcode == 0x0) { // Status Request
sendStatusResponse(channel);
... |
96945cd1-3a4e-49b7-b523-dc1667eec6cf | 8 | public static int pushAdjacent(PriorityQueue<Pair<Integer, Integer>> myQueue, int[][] canTravel, Pair<Integer, Integer> curr, Map<String, String> myMap, GreedyComparator comparator){
int currX = curr.getFirst();
int currY = curr.getSecond();
if(currX+1<canTravel.length && canTravel[currX+1][currY]==0){... |
d836223c-3aec-400e-ad6f-eef891b06151 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Ingredient other = (Ingredient) obj;
if (!Objects.equals(this.name, other.name)) {
return fal... |
c7d971c2-7c7a-4483-a67f-e0b2e9d7c4bd | 8 | public void update(MouseEvent event) {
int mask = (event.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK);
boolean buttonDown = mask == MouseEvent.BUTTON1_DOWN_MASK;
if (pressed && !buttonDown) {
pressed = false;
callback.invoke();
return;
}
... |
a1d9fed1-32f3-4b81-86fa-9e5b6f221fc5 | 6 | public void nextTurn() {
//Check For Winner
if(isWinner()){
return;
}
playerInTurn = turnDeterminer.nextTurn();
//Roll Dice
diceRollDeterminer.rollDice();
int[] dRoll = diceRollDeterminer.getDiceRoll();
if(turns == 0){
while(dRoll.length > 2){
diceRollDeterminer.rollDic... |
298d565e-4d4e-45f0-9264-cdec0268ca8a | 0 | IrcColor(String IRCColor, String MinecraftColor) {
this.IRCColor = IRCColor;
this.MinecraftColor = MinecraftColor;
} |
e7e1bc4e-e4fa-4b56-bd87-b9fa71fba53f | 7 | @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
switch(columnIndex){
case 0:
members.get(rowIndex).setName((String)aValue);
fireTableCellUpdated(rowIndex, columnIndex);
break;
case 1:
members.get(rowIndex).setSurname((String)aValue);
fireTableCellUp... |
ed192ec6-eb63-4d11-bd26-45cd6cd035bd | 2 | public String reverseWords(String s) {
String subStr[] = s.split(" ");
List<String> list = Arrays.asList(subStr);
ListIterator<String> li = list.listIterator(subStr.length);
String result = "";
while(li.hasPrevious()){
String temp = li.previous();
if(temp.equals("") == false)
result = res... |
387c3919-fe30-4467-a56e-811a1956541f | 8 | public static Arc2D getView(Critter self){
int degrees = 80;
double start = 0;
double width, height, x = 0, y = 0;
width = height = self.eyes*100;
x = self.getPosition().x;
y = self.getPosition().y;
if(self.view == Direction.NE){
start = 22.25 - 17.5;
}
else if(self.view == Direction.N){
... |
c14555d9-14fe-4e0d-9e00-bc7247897472 | 3 | @EventHandler(priority = EventPriority.MONITOR)
public void joinHandler(PlayerJoinEvent event) {
try {
if(plugin.hasPermission(event.getPlayer(), "mcnsaranks.players")) {
ListOnline list = new ListOnline(plugin);
list.List(event.getPlayer());
}
// set their rank colour for the display list
St... |
badcd1be-b1e2-4ac2-b07d-4f4827752b3f | 0 | public static String getData() {
return data;
} |
a88bc42e-0f54-4fda-9367-65dcbb0d372e | 8 | public static String trade(int[] prices){
ArrayList tradePlan = new ArrayList();
int i=0;
int low=prices[0];
int high=prices[0];
int buyin=-1;
int sellout=-1;
while(i<prices.length){
while(i<prices.length-1){
if(prices[++i]<=low){
low=prices[i];
}else{
buyin= i-1;
high=price... |
9df3bd63-96fc-480c-9a4b-a7a154976fdc | 5 | public static Coords findFirstCell(CellBase targetCell, Rotation direction, NeighbourhoodMatrix nextgen) {
// find where this cell is in the neighbours - TOD: consider passing this in as we surely know it?
Coords cellIndexInNeighbours = findMatchingCellInNeighbours(targetCell, nextgen);
Octant o = new Octant(c... |
71fc4c27-4db5-4bfe-a3ec-cb649f33f77d | 7 | private static void mergeImage(File parentFile) throws IOException {
int rows = 8;
int cols = 8;
int chunkWidth, chunkHeight;
int type;
// 读入小图
File[][] imgFiles = new File[rows][cols];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < ro... |
e546c732-2bed-4029-a6a2-e501998ff6d6 | 2 | private JButton prepareBrowseButton(final JTextField fileField)
{
JButton fileBrowse = new JButton("Browse");
fileBrowse.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMo... |
ef9b5720-78c1-44d7-85db-3d22d30c9a26 | 8 | private String getCodeDispt(int codeIndex){
String str="IF Weapon = ";
double[][] codeArr=this.WeaponSM.weight[codeIndex];
System.out.print("Print a code "+codeIndex+"\t");
for(int i=0;i<codeArr[0].length/2;i++){
if(codeArr[0][2*i]==1){
str+=this.allWeapons[i]+", ";
... |
c75d0984-dc60-4f75-9141-ee4d6f5dcf8e | 8 | private boolean edge_adj(Edge e1,Edge e2) {
if(e1.source.getId()==e2.source.getId() &&
e1.target.getId()==e2.target.getId()) return false;
else if(e1.target.getId()==e2.source.getId() &&
e1.source.getId()==e2.target.getId()) return false;
else if(e1.source.getId(... |
7de1b1e3-b7c2-457b-b35c-2afa4f987b63 | 0 | public int getSleepTime() {
return sleepTime;
} |
7f8928cc-1371-42a2-a9be-a66569788e82 | 3 | public ArrayList<String> wordBreak(String s, Set<String> dict) {
ArrayList<String> res = new ArrayList<String>();
if(s == null || s.length() == 0)
return res;
res = recBreak(s, dict);
return (res != null)?res:new ArrayList<String>();
} |
199907f3-77f7-407f-9054-ed982a3bb1e1 | 2 | public boolean collidedWithTile(BlockMap bmap)
{
for(int i = 0; i < bmap.entities.size(); ++i)
{
Block tile = (Block) bmap.entities.get(i);
if(poly.intersects(tile.poly))
{
return true;
}
}
return false;
} |
498888da-e183-4359-b0a3-2d37cb4c8f08 | 8 | private void listen()
{
try
{
while (isRunning)
{
try
{
/* Wait for a packet */
byte[] buffer = new byte[DATAGRAM_BUFFER_SIZE];
DatagramPacket packet = new DatagramPacket(buffer, buffe... |
873ce7cf-b136-4cc1-87e8-306a00027185 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[33];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 3; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
a8428b48-d5a5-43d6-a58d-ef008f720afc | 1 | private static void print(String sourceName, ImageInfo ii, boolean verbose) {
if (verbose) {
printVerbose(sourceName, ii);
} else {
printCompact(sourceName, ii);
}
} |
c549aec3-901d-48ce-aa60-d1d0c9ebd8fb | 0 | public FileDownloadItem(File saveFile, URL downloadUrl){
this.saveFile = saveFile;
this.downloadUrl = downloadUrl;
} |
dab02407-f52c-4bc3-8f2b-224bc434905c | 7 | public Action pollInput(){
while(Keyboard.next()){
if(Keyboard.getEventKeyState()) { // Only pressed keys
if(Keyboard.getEventKey() == Keyboard.KEY_SPACE){
//this.turn.setPause(!this.turn.isPause());
}
if(Keyboard.getEventKey() == ... |
a2bf793c-5951-45b1-b52c-331aedac0ed1 | 7 | public static FSList parseNodes(String fsxml) {
FSList result = new FSList();
try {
Document doc = DocumentHelper.parseText(fsxml);
for(Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext(); ) {
Element node = (Element)iter.next();
FsNode nn = new FsNode("unknown","unknown");
if ... |
0b1e698a-969c-4844-a03e-4167753a301d | 1 | private Settings() {
try {
this.listeners = new ArrayList<>();
this.rootElement = $( new File(FILENAME) );
} catch (SAXException | IOException e) {
ClientLogger.log("Soubor s nastavením neexistuje.", ClientLogger.ERROR);
}
} |
d64d517e-1705-401d-9614-894c26e3569f | 9 | public void characters(char ch[], int start, int length)
throws SAXException {
if(inLevelWidth) {
try {
level_width = Integer.parseInt(new String(ch, start, length));
} catch (NumberFormatException e) {
System.err.println("Breakout: Could not parse level_width");
System.exit(1);
}
}
if... |
08606c92-0570-47ca-8ff9-319fdfce7a09 | 4 | public Map<Integer, String> getNameHistory(UUID uuid) {
if (this.nameHistoryCache.containsKey(uuid))
return this.nameHistoryCache.get(uuid);
HashMap<Integer, String> history = new HashMap<>();
try {
HttpURLConnection connection = (HttpURLConnection) new URL("https://api... |
590c6b72-8a7f-462e-90c7-06c764c1d1f8 | 7 | public boolean exist(char[][] board, String word) {
// Start typing your Java solution below
// DO NOT write main() function
int m, n;
if (board == null || (m = board.length) == 0
|| (n = board[0].length) == 0)
return false;
boolean[][] flag = new boolean[m][n];
char x = word.charAt(0);
for (int i ... |
e7818a90-9dc1-47c4-a7c7-09b1d28765c1 | 7 | private void pushInsert(final int key, V value) {
// System.out.println("PushKeyHash:" + key + "\t" + hash(key.hashCode()) + "\t" +
// hash(hash(key.hashCode())));
int hash =hash(key);
int hash2 =hash2(key);
int hash3 =hash3(key);
// assert hash != hash2 && hash2 != hash3;
hash &=mask;
hash2 &=mask;
... |
7e7c6976-d157-4c7b-881f-45e791880a4c | 3 | private void makeAgents() {
// Run through and make new agents.
agents = new Vector();
Agent lastAgent = null;
for (int i = 0; i < numberOfAgents; i++) {
Agent temp = new Agent();
temp.setName("Agent-" + i);
// Random geographical position.
int x = (in... |
65d7099f-92e4-4ea8-9d2f-87910483083b | 6 | public Key engineGetKey(String alias, char[] password)
throws UnrecoverableKeyException
{
if (!loaded) {
throw NOT_LOADED;
}
if (keyring == null) {
return null;
}
if (!(keyring instanceof IPrivateKeyring)) {
throw new IllegalStateException("not a private... |
93fa7242-c078-4adb-a310-3f0ec326593e | 7 | @Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (surname != null ? surname.hashCode() : 0);
result = 31 * result + (passportNumber != null ? passportNumber.hashCode() : 0);
result = 31 * result + (inn != null ? inn.hashCode() ... |
9a48be6c-b11a-4211-ad49-967f02155212 | 1 | public List<Fleet> Fleets() {
List<Fleet> r = new ArrayList<Fleet>();
for (Fleet f : fleets) {
r.add(f);
}
return r;
} |
210b7d68-df51-48e1-9e71-c92c8e43481b | 1 | public void remover(Curso curso) throws Exception
{
String sql = "DELETE FROM curso WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setLong(1, curso.getId());
stmt.executeUpdate();
}
catch (SQLException e)
{
throw e;
}
} |
f5642173-1bb8-407f-9465-e06db408a86c | 2 | private String formatLI(String content, boolean ordered) {
String buf = "";
int idx = 0;
int aStart = 0;
int aEnd = -5;
int i=0;
while (content.indexOf("<li>", idx) != -1) {
i++;
aStart = content.indexOf("<li>", idx);
buf += content.substring(aEnd+5, aStart);
aEnd = content.indexOf("</li>", aS... |
8a00a89e-7783-4aa7-8ffb-0db6d682c095 | 3 | public boolean isEmptySpace() {
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 16; j++) {
if(entries[i][j].getText().equals("")) {
System.out.println("isEmptySpace() returned false at i: " + i + " j: " + j);
return false;
}
}
}
return true;
} |
6d0950a8-264b-41d3-a622-66b5935be980 | 3 | public void update(EmployeeModel employeeModel) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getInstance().openSession();
session.beginTransaction();
session.update(employeeModel);
session.getTransaction().commit();
}... |
dd73bcd4-fcb4-47fe-abce-f8711c1a679d | 3 | private double testPriorityQueueInserts(int[] inserts) {
System.out.print("Testing PriorityQueue with " + inserts.length + " inserts... ");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
priorityQueue = new PriorityQueue();... |
574337d6-6d72-4a7f-a0c8-233864724937 | 3 | public boolean setMat(double length/*, Mat mat*/) {
if (jumpheight != 3 && length >= this.length && !matOnTheFloor) {
matOnTheFloor = true;
//this.mat = mat;
return true;
}
else {
return false;
}
} |
3c6597ff-81e4-4d55-9627-e8518dcc979b | 0 | public boolean GetBusActiveStatus(int busNumber)
{
//get the status of the bus
return busActiveStatus[busNumber];
} |
a3866760-346f-4d07-9175-f8e9cf35d99b | 2 | HashSet<Integer> getVertexGroup(int vertex) {
for (HashSet<Integer> vertexGroup : vertexGroups) {
if (vertexGroup.contains(vertex)) {
return vertexGroup;
}
}
return null;
} |
2cf577e3-7c89-400f-8c98-0451899d54c6 | 3 | public static JSONObject toJSONObject(String string) throws JSONException {
String n;
JSONObject o = new JSONObject();
Object v;
JSONTokener x = new JSONTokener(string);
o.put("name", x.nextTo('='));
x.next('=');
o.put("value", x.nextTo(';'));
... |
8d2aac22-b8f3-4581-9e9c-c36b05607114 | 2 | public double rawStandardDeviationCorrelationCoefficientsWithTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.rawStandardDeviationRhoWithTotals;
} |
9fe19bd0-e474-4d7e-bf2e-8027d428e1c3 | 8 | public List<Funcionario> buscar(Funcionario filtro) {
try {
String sql = "select * from pessoa p join funcionario f on p.IdPessoa = f.IdPessoa where ativo = 1 ";
String where = "";
if (filtro.getNome().length() > 0) {
if (where.length() > 0) {
... |
0a908832-44ae-4e05-898c-6bd0b4fd1724 | 4 | public boolean hasPathSumRec(TreeNode root, int sum) {
if(root == null) return false;
if(root.left == null && root.right == null) return sum == root.val;
return hasPathSumRec(root.left, sum - root.val) || hasPathSumRec(root.right, sum - root.val);
} |
44ccf5fe-a12c-444c-b4fd-630559ea0b86 | 2 | @Override
public int hashCode() {
int h = -1;
h ^= this.comment.hashCode();
h += this.op;
h += this.htype;
h += this.hlen;
h += this.hops;
h += this.xid;
h += this.secs;
h ^= this.flags;
h ^= Arrays.hashCode(this.ciaddr);
h ^= Arrays.hashCode(this.yiaddr);
h ^= Arrays.hashCode(this.siaddr);
h... |
ae2683f0-749c-47ef-ae8e-76c7bf4aa82f | 3 | public void InsertaMedio (int ElemInser,int Posicion)
{
if (VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
if (Posicion<=1)
InsertaInicio(ElemInser);
else
{
NodosProcesos Aux = PrimerNodo;
int i = 2;
... |
4a3de434-0ef4-4a8d-8211-183028ebeb3f | 2 | boolean setSpeed(int speed) {
if (speed < 0 || speed > 10)
return false;
this.speed = speed;
return true;
} |
54ab9272-42ef-4ad1-adc4-72470d528417 | 5 | private static BigInteger mp(BigInteger base,BigInteger exponent,BigInteger modulus) {
BigInteger result=BigInteger.ONE; // initialize variable
// failsafe
if( base.compareTo(BigInteger.ONE) < 0 || exponent.compareTo(BigInteger.ZERO) < 0 || modulus.compareTo(BigInteger.ONE) < 1) {
return BigInteger... |
932c688f-cb09-44b2-9b94-00238c0788af | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.tool() instanceof I... |
152c31b4-ede3-4d80-8e88-78ea6fa64005 | 3 | private void setListData() {
ArrayList<ItemObject> filteredList;
ItemObject[] filteredItems;
String filterValue, itemName;
int index;
filteredList = new ArrayList<ItemObject>();
filterValue = editFilter.getText().toLowerCase();
if ( !filterValue.isEmpty() ) {
f... |
3d601359-2916-45be-b3ce-936fe0cb3fb9 | 0 | @Override
public boolean supportsComments() {return true;} |
5da4def7-65f1-47d5-b23c-6b3f5b4bc56f | 8 | */
@Override
public void mouseClicked(MouseEvent e)
{
int numOfRecs = lines.uniqueID.size()-1;
String[] recordMin, recordMax;
String xyMin, xyMax;
Double x1, y1, x2, y2;
int x,y;
Boolean upLeft = false;
Double[] coordinates;
// the pur... |
284b016a-06fc-49f4-b4c8-ea41144f00ee | 4 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile;
return Tile.getByColour(tiles[x + y * width]);
} |
35808972-c57f-4c34-b7fd-abfabd02c1f5 | 9 | @DBCommand
public boolean list(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.list")) {
sender.sendMessage(ChatColor.DARK_RED
+ "You don't have permission to use this command!");
return true;
}
int page = 1;
... |
0e5ae2da-e2c6-47ed-b045-369c1388bbd2 | 1 | public void testForFields_empty() {
try {
ISODateTimeFormat.forFields(new ArrayList(), true, true);
fail();
} catch (IllegalArgumentException ex) {}
} |
8a5308cb-49e1-4cba-86e1-86b8cb7830dd | 5 | public void run() {
double ticksPerSecond = 60;
int nanoSecondsPerTick = (int) (1000000000/ticksPerSecond);
long timePassed = 0;
long lastTime = System.nanoTime();
long now;
long tickTimer = System.currentTimeMillis();
while (running) {
now = System.nanoTime();
timePassed += now - lastTime;... |
e3428dab-6855-4cd1-8d7a-bec3ca7d6476 | 4 | static Network randomizeWeights(Network n)
{
Random rand = new Random();
for (int i = 0; i < n.getAddedNeurons(); i++)
{
for (int j = i + 1; j < n.getAddedNeurons(); j++)
{
if (n.getWeightMatrix()[i][j] != 0)
{
int randNumber = rand.nextInt(11) - 5;
while (randNumber == 0)
randNumbe... |
e0d4bb73-f180-4a00-994f-4888aaaa6ab5 | 9 | @Override
public void run() {
try {
while (run) {
String message = din.readUTF();
switch (Integer.parseInt(message.substring(0, 1))) {
case 1:
gui.displayMessage(message.substring(1), ChatGUI.INCOMMINGMESSAGE);
... |
8e56912c-8f69-401b-b3d4-c4e7d5ad4709 | 1 | protected void activateIfNotActive() {
if (!active) {
activate();
}
} |
b093b3ea-1e68-4c04-af4d-bed559dd142b | 5 | protected void ensureSimpleValues(Map.Entry<String,Set<RDFNode>> prop, Class<?> expectedClass)
throws RDFStructureException
{
for( RDFNode n : prop.getValue() ) {
if( !n.hasOnlySimpleValue() ) {
throw new RDFStructureException("Expected a simple value for "+prop.getKey(), n.sourceUri);
}
if( n.simpleV... |
382404e8-9887-4d99-a93d-93c5e901bfda | 7 | static final Class258_Sub3_Sub1 method904
(int i, OpenGlToolkit var_ha_Sub2, int i_24_, int i_25_, int i_26_) {
try {
anInt1594++;
if (i <= 42)
method906(123);
if (((OpenGlToolkit) var_ha_Sub2).aBoolean7793
|| (Class192.method1436(82, i_25_)
&& Class192.method1436(81, i_26_)))
return new Cl... |
a1deabe8-bc3e-4595-802c-5e6a067203db | 7 | public static AdjListNode[] genRandomDirectedGraph(int vertexCount) {
if(vertexCount <= 0) {
return null;
}
AdjListNode[] graphList = new AdjListNode[vertexCount];
Random random = new Random();
for(int i=0;i<vertexCount;i++) {
if(graphList[i] == null) {
graphList[i] = new AdjListNode(String.value... |
38f9db8e-babe-4ec5-971d-4c57c092ea10 | 7 | @Override
public String format(byte[] bytes) {
char[] result = new char[_length];
int i = 0;
int offset = 0;
if (_prefix != '\0')
result[offset++] = _prefix;
for (; i < 4; i++) {
int value = bytes[i];
result[offset++] = hexToChar(value >> 4, _alpha);
result[offset++] = hexToChar(value, _alpha);
... |
8ac0b4b9-0fa8-4e06-bebb-46f6cdfecb1b | 8 | public boolean equalsIgnoreVersion(Dependency other) {
if (other == null) {
return false;
}
if (getClass() != other.getClass()) {
return false;
}
if ((this.groupId == null) ? (other.groupId != null) : !this.groupId.equals(other.groupId)) {
retu... |
432b9fe4-95e4-41fc-837f-a1c3344b1cf6 | 3 | private void svgCanvasMouseReleased(MouseEvent evt)
{
int objectIndex = -1;
if(jTabbedPane2.getSelectedIndex() == 0)
{
objectIndex = drawComponent1.checkSelection(evt.getX(), evt.getY());
drawComponent1.setActObject(objectIndex);
}
else if(jTabbedPane2.getSelectedIndex() == 1)
{
objectIndex = dra... |
4a8ed527-91d8-4053-bbd9-2aa9262abe26 | 6 | public Topic initTopic(String url, Map<String, String> regroupement, int maxEssaiConnexion) throws StatopicException{
System.out.println("Recuperation des donnees...");
Document doc = jvcApi.getDocument(url, maxEssaiConnexion);
Topic topic= new Topic(jvcApi.obtenirSujet(doc));
// ON EST A LA PREMIERE PAGE ON ... |
f3075c40-3f9f-448c-9b74-e1e51d2da3dc | 6 | private static void writeDereplicateFiles( File dir) throws Exception
{
String[] files = dir.list();
for( String s : files)
if( s.startsWith(REP_PREFIX))
{
File file = new File(dir.getPath() + File.separator + s);
HashMap<String, Integer> map = new HashMap<String, Integer>();
FastaSe... |
c3d9df81-083f-413f-ad07-3a89a0515512 | 8 | private double leastSquaresNonMissing(Instances instances, int attIndex) {
double numerator=0, denominator=0, w, t;
double[] classMeans = new double[m_numOfClasses];
double[] classTotals = new double[m_numOfClasses];
for (int i=0; i<instances.numInstances(); i++) {
LADInstance inst = (LADInstanc... |
fdd9c72f-ee1a-430c-81a5-075a361fcdb8 | 2 | public static void main(String[] args){
long sum=1;
int curr=1;
for (int i=2;i<1001;i+=2){
for (int j=0;j<4;j++){
curr+=i;
sum+=curr;
}
}
System.out.println(sum);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.