method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5aeb48bd-8b91-4aa8-a759-df710374d0f6 | 9 | private void constructmsg() {
if (stringToInt(headerLength.getText()) < 8) {
headerLength.setText("8");
}
msg = new int[stringToInt(headerLength.getText()) + 2];
msg[0] = 0xfc;
msg[1] = stringToInt(headerLength.getText());
msg[2] = stringToInt(headerType.get... |
9d064923-4f7a-4f1d-a5a5-40c37d82c8a6 | 6 | public void actionPerformed(ActionEvent e)
{
GuiCommand command = GuiCommand.getCommand(e.getActionCommand());
if(state == State.Login)
{
switch (command)
{
case ServerStart:
{
ServerHelper.getNetworkManager().connec... |
f3e60065-d09c-40b1-99d0-68732e33d08f | 1 | @Override
public List findAll() throws Exception {
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
//Query q = session.getNamedQuery("find.all");
Query q = session.getNamedQuery(getNamedQueryToFindAll());
... |
9ddeffd5-c26f-43e0-a88b-53b9b39c4d8d | 8 | private int generateFileListing( OutputStream out )
throws IOException {
// WARNING: due to the AbstractDirectoryResource-specs it is NOT GUARANTEED that the file
// is really a directory!
StringBuffer lineBuffer = new StringBuffer();
if( !this.getDirectoryFile().isDirectory() ) {
// Print the f... |
455de6a8-fca5-491b-9dc4-e5cf07548b6d | 2 | @Override
public void onRobotUpdate(RobotUpdateEvent e) {
if(missile == null) {
missile = setFireMissile(e.getPosition().sub(getPosition()));
target = e.getName();
} else if(e.getName().equals(target)) {
missile.setThrust(e.getPosition().sub(missile.getPosition()));
}
} |
9d2aa3fa-143e-441a-a311-dc454a914c46 | 5 | public static void main(String[] args) {
//Settings
String APIURL = "https://sandbox.thesecuregateway.com/rest/v1/transactions";
String APIKEY = "fc594b6c6fd4493db932d7ae50f8c56e";
int TIMEOUT = 15000; //Milliseconds
String LANG_TYPE = "json"; //"xml" or "json"
//Transa... |
312b891a-70bd-44ac-bb7c-3465c03d496f | 6 | public WumpusPerception eventMove(AID hunterAID) {
Hunter hunter = getHunter(hunterAID);
int previousXCoord = hunter.getxCoord();
int previousYCoord = hunter.getyCoord();
hunter = hunter.move();
int currentXCoord = hunter.getxCoord();
int currentYCoord = hunter.getyCoord();
WumpusPerception perce... |
acd8fb0d-9118-477b-a81e-e3f0f20fae52 | 2 | public void reconnect()
{
// Socket/RTMP reconnect
super.reconnect();
// Then login
while (!isLoggedIn())
{
try
{
login();
}
catch (IOException e)
{
System.err.println("Error when reconnecting: ");
e.printStackTrace(); // For debug purposes
sleep(5000);
super.reconnect();... |
548e1737-2ef6-4ed5-b41d-296861556891 | 5 | public void minusCount(String name) { //Checks the name of the Draggable and minuses the count of that Draggable
if (name == "Lake") {
lakes--;
} if (name == "Crater") {
craters--;
} if (name == "Archer") {
archers--;
} if (name == "Warrior") {
warriors--;
} if (name == "Wall") {
walls--;
}
... |
03cde1ac-ad49-4415-934a-6de3a7e393a5 | 9 | private static void dumpDynamicObjects(RT6CacheSystem cache) {
ObjectDefinitionLoader loader = cache.objectLoader;
ScriptLoader scriptLoader = cache.scriptLoader;
//final Joiner joiner = Joiner.on(", ").skipNulls();
PrintWriter writer = null;
try {
writer = new PrintWriter(new File("dynamic_objects.java"))... |
28a61c02-3670-4efc-b01d-69107a294680 | 2 | private static void ifft2() {
ImageData imageData = originalImage.getImageData();
FFT2 fft2 = new FFT2();
fft2.ifft2(imageData.height, imageData.width, complexData);
int[][] pixels2i = fft2.getPixels2i();
for (int row = 0; row < imageData.height; row++) {
for (int col = 0; col < imageData.width; col++) {
... |
c90b60cd-d514-4d26-9949-5d320819b563 | 0 | private void help() {
System.out.println(
"Available Commands\n\n"
+ "n [num]: set number of items to insert\n"
+ "m [num]: set number of right shifts of optimal bloom filter length\n"
+ "k [num]: set number of hash functions to use, none or 0 for optimal\n"
+ "bits [num]: set number of bits to check f... |
4b0c9fd9-901c-4951-a314-ea3808ee0c38 | 8 | @Override
public ObjectInspector initialize(ObjectInspector[] arguments)
throws UDFArgumentException {
if (arguments.length != 1) {
throw new UDFArgumentTypeException(arguments.length-1,
"One arguments are required");
}
ObjectInspector returnObjectInspector = Primit... |
222454b4-f7db-452b-bb9c-a2780d49488d | 9 | @SuppressWarnings("deprecation")
public static void main(String[] args) {
HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>();
HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>();
HashMap<Integer, String> stationIdName... |
db230aa3-6549-4107-b371-44d91c25aeaf | 8 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender cs, Command cmd, String string,
String[] args) {
if (string.equalsIgnoreCase("myleap")) {
if (!(cs instanceof Player)) {
cs.sendMessage("This is a player only command!");
} else {
Player player = (Player) cs;
if (... |
608472c2-afe3-4abe-b9a3-03d353dc9c8c | 6 | @EventHandler
public void SilverfishSlow(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble("Silverfis... |
08be5622-2dc3-4542-98c3-a0cd8715779e | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Comment comment1 = (Comment) o;
if (id != comment1.id) return false;
if (comments != null ? !comments.equals(comment1.comments) : comment1.comm... |
7d09ed4e-4e09-4e1c-8102-b6e4de104305 | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
return false;
} catch (UnsupportedAudioFileException e) {
return false;
} catch (LineUnavailableException... |
15a0c287-4d5b-43b8-bfcb-65f5ce942448 | 4 | protected static void rechercheMembre(){
System.out.println("Entrez le nom ou le pseudo du membre que vous recherchez.");
System.out.print(">>>");
String entry = entreeNonVide("");
Membre resPseudo = dbM.rechercherMembrePseudo(entry);
ArrayList<Membre> resNom = dbM.rechercherMembresNom(entry);
if(resPseud... |
fc81084b-a745-4c30-9b39-01898a90f8c6 | 4 | @Override
public void setBoolean(long i, boolean value)
{
if (ptr != 0) {
Utilities.UNSAFE.putDouble(ptr + sizeof * i, value == true ? 1.0 : 0.0);
} else {
if (isConstant()) {
throw new IllegalAccessError("Constant arrays cannot be modified.");
... |
8b825b52-de36-40f3-b751-4470e020b1d4 | 6 | private void GLRender() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-camX, -camY, -camZ);
glRotatef(xRot, 0, 1, 0);
glRotatef(yRot, 1, 0, 0);
// Axis
glBegin(GL_LINES);
if (drawAxis) {
glColor3d(1, 0, 0);
glVertex3f(axis[0], axis[1], axis[2]);
... |
105c21eb-4ed5-4256-965d-8d6752352ecd | 0 | public ArrayList getExtensionList() {return extensionList;} |
1fece475-d552-49d1-95f8-932af73b6b21 | 0 | public static void main(String[] args) {
System.out.println(types);
} |
52b12b3a-471c-4c8a-880c-16b3ff7620d7 | 3 | public Matching(boolean needsAnswer){
col1Choices = new ArrayList<String>();
col2Choices = new ArrayList<String>();
answer = new HashMap<Integer, Integer>();
prompt = InputHandler.getString("Enter the prompt for your Matching question:");
int numChoices = InputHandler.getInt("Enter the number of choices: ");
... |
131688b6-92c9-4a64-aa3d-b9f5d0c3a264 | 5 | final public void Cond_Op() throws ParseException {/*@bgen(jjtree) Cond_Op */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTCOND_OP);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t;
try {
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case EQUAL:{
t = jj_consume_... |
06ed2499-6813-4588-b089-9de62713121f | 1 | public void resetAll() {
setKills(-1);
setDeaths(-1);
setKit(null);
setMoney(-1);
setKillstreak(-1);
for (The5zigModTimer timer : timers) {
timer.cancel(getPlayer());
}
} |
1ff4f34b-dd58-49d0-87cc-6bdad5c6672e | 6 | public static void main(String[] args)
throws IOException, FileNotFoundException{
final int N = 200; // total number of vertice
int adjmat[][] = new int[N][N];// adjmatrix initializing.
BufferedReader br = new BufferedReader(new FileReader("dijkstraData.txt"));
String line, str;
while((line = br.readL... |
8dc78717-b460-45d1-89b1-79fe3d802a7f | 7 | private int buildStraight(int xo, int maxLength, boolean safe)
{
int length = random.nextInt(10) + 2;
if (safe)
length = 10 + random.nextInt(5);
if (length > maxLength)
length = maxLength;
int floor = height - 1 - random.nextInt(4);
//runs from t... |
c95af41c-7e34-43b2-922d-74427a19099f | 1 | public static void resetTexture(int texture) {
if (Rasterizer.textureCache[texture] == null) {
return;
}
Rasterizer.textureStore[Rasterizer.textureStoreCount++] = Rasterizer.textureCache[texture];
Rasterizer.textureCache[texture] = null;
} |
0125447f-9c1b-4550-84f1-3129e8b70a02 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if((msg.target()==null)
||(!(msg.target() instanceof Item)))
return true;
final MOB mo... |
3ab366e0-01af-41b6-9868-cdd4010a59bf | 4 | public void append(String s) {
while (isPaused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
super.append(s);
if (autoScroll) {
int length = getText().length();
... |
b62dc9e3-88a6-4ede-8119-9793e1f67bcb | 6 | public void runJava()
{
/* timeout variables
long startTime;
long currentTime;
long timeOut = 60000000000L;
*/
try
{
// set up input files
// TestInput.txt has inputs for each test on a single line
File testInputFile = new File(testInputFileName);
Scanner testInputs = new ... |
e4dabfad-02ec-4ad6-ab83-635620bd446c | 1 | @Override
public void writeToDB(MyObjects data) {
System.out.println("Simulating database write:");
for (String line : data.getLines()) {
System.out.println(" > " + line);
}
} |
3de139b3-7482-4ca8-967e-d426cfd10c02 | 8 | public String[] search(String[] fields, String keyword, int startRow, int howManyRow) {
Directory directory = null;
IndexSearcher searcher = null;
IndexReader reader = null;
String[] resutlstr=new String[howManyRow];
try {
//使用 IKQueryParser类提供的parseMultiField方法构建多字段多... |
75fbed52-32d8-459b-8b98-34599a949e72 | 5 | @Override
protected long calculateBase(final long base, final long remainder, final int droppedDigits, final int layoutBase)
{
final long roundedBase = base + ((base > 0 && remainder != 0) ? 1 : 0);
if (layoutBase != 1)
{
final long layoutRemainder = roundedBase % layoutBase;
if (layoutRemainder != 0)
{... |
7f61574d-a9dd-4583-bddc-a306c215da3e | 3 | public SignatureVisitor visitParameterType() {
if (type != METHOD_SIGNATURE
|| (state & (EMPTY | FORMAL | BOUND | PARAM)) == 0) {
throw new IllegalArgumentException();
}
state = PARAM;
SignatureVisitor v = sv == null ? null : sv.visitParameterType();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);... |
d458fa1f-7d6c-4662-a7fc-770abe490e54 | 0 | public String getType() {
return "turing";
} |
2bea96f2-ccd1-43ba-a201-54bead5659e5 | 6 | public void applyChanges() {
ProjectView.PROJ_VIEW_WIDTH = (Integer) pvWidthSpinner.getValue();
ProjectView.PROJ_VIEW_HEIGHT = (Integer) pvHeightSpinner.getValue();
int r = curBackColor.getRed();
int g = curBackColor.getGreen();
int b = curBackColor.getBlue();
if(r > 220 && b > 220 && g > 220) {
cu... |
ae47398e-eac6-46c6-b909-ef49875d321b | 5 | private BufferedImage toBufferedImage(Image image) {
// This method returns a buffered image with the contents of an image
if (image instanceof BufferedImage) {
return (BufferedImage) image;
}
// This code ensures that all the pixels in the image are loaded
image = new ImageIcon(image).getImag... |
bfec5463-d0ff-4943-8e80-efb66d8052da | 3 | public static List<Oppilas> getOppilaat() {
Connection c = connect();
if (c == null) return null;
try {
List<Oppilas> oppilaat = new ArrayList<Oppilas>();
PreparedStatement ps = c.prepareStatement("SELECT * FROM oppilas " + "JOIN ryhma ON oppilas.ryhma = ryhma.ryhmaID;");
ResultSet rs = ps.executeQuery(... |
f87bede8-bdf1-4b1e-aea8-ea2a09f5b551 | 4 | public static SlotMachine getFromLever(Block b) {
Set<String> keys = null;
try {
keys = Global.config().getConfigurationSection("machines").getKeys(false);
} catch(Exception e) { return null; }
for(String k : keys) {
String parentNode = "machines."+k;
String leverNode = parentNode+".leverLoc";
World... |
4060b2c9-8845-4605-86bc-205dfe8f6413 | 0 | SimpleVector getLocation() {
return location;
} |
f4648bbd-1658-4527-b17d-8a2b8c63116f | 9 | private void setRandomSymbols(String menuOption) {
textArea.setText("");
String root = null;
if (menuOption == pRandomDigits) {
root = "<RandomDigits>";
}
else if (menuOption == pRandom2Element) {
root = "<Random2E... |
22d6b469-c782-4278-9cd8-aabe39e13bb4 | 3 | public void spawnMobs() throws SlickException{
int mapId = this.map.getId();
while(mobs.size() < 3){
int random = (int) (Math.random() * 3);
Mob mob = null;
if(mapId <= 4){
mob = MobSpawner.getMob((mapId-1) * 3 + random);
}else if(mapId == 5)
mob = MobSpawner.getMob(12);
mobs.add(mob);
}
} |
a1b93366-3324-4636-8051-37b811c14906 | 9 | public static boolean checkForRAWHazard(Instruction currentInstruction,
Instruction previousInstruction) {
if (previousInstruction == null || currentInstruction == null) {
return false;
}
int prevRegTarget = 0, currentRegSource1 = 0, currentRegSource2 = -1;
if (previousInstruction instanceof ITypeIns... |
4623ad62-e555-427b-82d4-324f6c663e71 | 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... |
7485ddbb-d06f-42c2-b487-eaa513d73f8c | 2 | @Override
public int hashCode() {
int result = a != null ? a.hashCode() : 0;
result = 31 * result + (b != null ? b.hashCode() : 0);
return result;
} |
1c206b1c-41be-4555-ba63-f6ebc8cd0567 | 2 | private void clicked(core.Hero hero, WidgetStackGrid list, core.Position2Object<GroupOfUnits> p2u, int r, int c)
{
if (r > -1) {
hero.getUnits().remove(p2u.get(r, c));
}
list.clearLevel(3);
list.clearLevel(4);
p2u.clear();
int i = 0;
for (core.GroupOfUnits u: hero.getUnits()) {
list.getImageStac... |
f98a52e3-10d6-42a1-8c83-9fd74fd2960f | 5 | private void updateDialog(JTextPane area){
for (String s : Main.programLogs){
if (s.contains("#RED#")) {
s = s.replace("#RED#", "");
appendToPane(area, s + "\n", Color.RED);
} else if (s.contains("#BLUE#")) {
s = s.replace("#BLUE#", "");
... |
f7afaa04-a4ca-4ad0-9260-87d9d6bc111a | 2 | public void Return(int isbn) {
int flag=0;
for(int i=1;i<=5;i++)
flag=B[i].Return(isbn);
if(flag==1)
System.out.println("\nBook re taken successfully\n");
else
System.out.println("Sorry! please talk to the librarian\n");
} |
2d2f4d7d-13ef-44bd-bdad-9bfabb1819c3 | 4 | @Override
public void combatResultEvent(CombatResults result) {
if (result.getVictory()) {
if(this.enemy.getName() == Enemy.getBee().getName()){
this.character.setHealth(this.character.getHealth() + 10);
}
else if (this.enemy.getName() == Enemy.getSpider().getNa... |
8085e7d0-a8ff-4d49-8e04-89e5b07a6784 | 9 | private long[] readCpu(final Process proc) {
long[] retn = new long[2];
try {
proc.getOutputStream().close();
InputStreamReader ir = new InputStreamReader(proc.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String l... |
b3b1fc85-09f7-4ab7-b08c-d99919513cc6 | 0 | public static long getSerialversionuid() {
return serialVersionUID;
} |
09e31337-21ad-4b60-9cb7-7574eb2372b9 | 3 | private boolean hasMaxChildHeuristic(Map <Integer, Integer> heuristicMap) {
Integer maxWeight = 0;
for (TrieNode child : this.children.values()) {
Integer weight = heuristicMap.get(Integer.valueOf(child.getId()));
if (weight != null && weight > maxWeight) {
maxWeight = weight;
}
}
... |
87a8c1b9-5abe-4fad-bd72-6e5953393b61 | 5 | @Override
public void startTitleMusic() {
musicVolume = Options.getAsFloat(Options.MUSIC, "1.0f");
if (!isMuted() && hasOggPlaybackSupport()) {
if (isPlaying(BACKGROUND_TRACK))
stopBackgroundMusic();
String backgroundTrack = "/resources/sound/ThemeTitle.ogg";
try {
File backgroundFile = ne... |
0f1c6fd8-26c9-4c3f-b6c6-bc8b268631c8 | 8 | protected void buildModule(Document doc, Map<Artifact, String> moduleMap) throws MojoFailureException, XPathExpressionException {
// check if there is a mapping in the dictionary for the project artifact
DictItem mapping = dictionary.find(project.getGroupId(), project.getArtifactId(), project.getVersio... |
fa3ce3fe-1cf8-460f-b117-104d76a584b4 | 3 | public void set(Property pProperty)
{
if(pProperty != null) {
if(mProperties == null) {
mProperties = new LinkedList<Property>();
} else {
Property tExisting = get(pProperty.getClass());
if(tExisting != null) {
mProperties.remove(tExisting);
}
}
mProperties.add(pProperty);
... |
f2e93d1f-5e33-4854-94fb-693cecafd417 | 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... |
f134a29e-2fb9-4194-88e1-591664bbc635 | 9 | */
private Expression parsePseudoXML(boolean allowEndTag) throws XPathException {
try {
Expression exp = null;
int offset = t.inputOffset;
// we're reading raw characters, so we don't want the currentTokenStartOffset
char c = t.nextChar();
switch ... |
d2eb9054-f2d9-4a1d-9162-da93302de02b | 7 | public boolean attempt(long msecs) throws InterruptedException {
// log.debug("attempt()::" + Thread.currentThread().toString());
if (Thread.interrupted()) {
throw new InterruptedException();
}
synchronized (this) {
if (!inuse_) {
inuse_ = true;
... |
05effb15-a836-4edc-87a5-94bc9ea8ab2b | 5 | @Override
public User determineWinner(CommunityCards cc, ArrayList<User> allGameUsers) {
// Put all the cards and their suits in an array for easy access.
ArrayList<ArrayList<String>> commCardsArray = new ArrayList<ArrayList<String>>();
for (int i = 0; i < CommunityCards.NUM_CARDS; i++) {
ArrayList<String> c... |
1174888e-2406-4d30-b27d-8635eb98fa53 | 2 | public void todaysDealsAddToCartTest(DriverGenerator dg) {
// boiler plate
WebDriver wd = dg.generate();
LoggedOutPage pph = new LoggedOutPage(wd);
// setup;
boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE);
boolean foundAndClickedOnElement = pph.clickOnVisibleElement(TODAYS_DEALS_LINK);
// assertions... |
c16e294a-b1c9-4a48-bf36-7ca7d617bdb6 | 7 | public void paint(Graphics g){
g.drawImage(bg, 0, 0, this); //draw background
super.paint(g);
Graphics2D g2D = (Graphics2D)g.create();
if(pika1.getIfJump() == true){
if(pika1.getPowHit() == true)
g2D.drawImage(pika1.getImage4(), pika1.getX(), pika1.getY(), 100, 100, this);
else
g2D.drawIma... |
23b0f284-4360-4236-9fe7-d58ce1fa4a57 | 8 | private Node Insert(final Rectangle aRect)
{
if (children != null) // not a leaf
{
// try inserting into first child
Node node = children[0].Insert(aRect);
if (node != null)
return node;
// no room, ins... |
e44f3d66-7095-4a20-83dc-02843a7605dd | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
do {
line = in.readLine();
if (line == null || line.length() == 0)
break;
size = Integer.parseInt(line);
... |
17f14b6e-65b8-46d4-a31b-e99680ee646f | 6 | public static void getHitsFromCDD(String queryString, Map<String, CyIdentifiable> reverseMap,
Map<CyIdentifiable, List<CDDHit>> hitMap) throws Exception {
BufferedReader in = queryCDD("hits", queryString);
List<String> inputLines = new ArrayList<String>();
String line;
while ... |
14de627d-7910-4281-8ea9-cc4d471ef4ee | 5 | public static String getOtherItem(String item){
try {
File file = new File("/Users/anuj/Documents/Adobe Flash Builder 4.6/Puppybox/bin-debug/assets/syllabus.xml");
DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = dBuilder.parse(file);
NodeList fir... |
77763572-3147-43dc-80ce-64b6884729fe | 8 | public boolean isSymmetricHelper(TreeNode left, TreeNode right) {
if (left == null && right == null) {
return true;
}
if ((left == null && right != null) || (right == null && left != null)) {
return false;
}
return (left.val == right.val)
&& isSymmetricHelper(left.left, right.right)
&& isSymmetr... |
8de164a9-f40c-4ee2-b4b8-aaf40634a1a4 | 9 | public void start() {
new Thread() {
public void run() {
while (true) {
double add = 0;
for (Iterator<ReadableSound> it = readables.keySet()
.iterator(); it.hasNext();) {
ReadableSound r = it.next();
double a = r.read();
add += a / 10;
if (quietSamplingCount++ >= ... |
9704a8dd-6047-4f84-a500-28242f4054c6 | 0 | @Test
public void smallGraphTestAddedTwoVerticesAndOneEdge() {
Graph g = GraphParser.initialize(t1);
assertEquals(2, countVertices(g));
assertEquals(1, countEdges(g));
} |
9d7c9cd1-bea9-4466-ab60-0e297a3ed358 | 1 | public StructuredBlock appendBlock(StructuredBlock block) {
if (block instanceof EmptyBlock) {
moveJump(block.jump);
return this;
} else {
SequentialBlock sequBlock = new SequentialBlock();
sequBlock.replace(this);
sequBlock.setFirst(this);
sequBlock.setSecond(block);
return sequBlock;
}
} |
ce9efbf6-950a-4f8d-8c6d-3193dd186e4d | 4 | public void run()
{
long startTime = System.nanoTime();
LinkedList<Integer> list = new LinkedList();
int length = a.length;
for(int i=0;i<length-1;i++)
{
int index = i;
for(int j=i+1;j<length;j++)
if(a[j] < a[index])
index = j;
int temp = a[index];
a[index] = a[i];
a[i] = temp;... |
b8af878e-6194-426f-a674-2b468fce5bed | 9 | @Override
public String generateWADL(String wsdlPath)
{
String fileName = "";
try
{
wadl wadlFile = new wadl();
setMethodInfo(wadlFile, wsdlPath);
setIOparams(wadlFile, wsdlPath);
String wadl = wadlFile.header;
wadl += " <r... |
68e2b3f0-4f72-478e-a610-31d0a6a51efd | 9 | final int[][] method2778(int i, boolean bool) {
anInt10181++;
if (bool != true) {
method2823(-66, (byte) -55, 10, 84);
}
int[][] is = aClass348_7454.method3981(i, 3168);
if (aClass348_7454.aBoolean4300) {
int[][] is_21_ = this.method2777(-80, 0, i);
int[] is_22_ = is_21_[0];
int[] is_23_ = is_21_[... |
0c35a928-99ce-4bd7-81f8-fc46d152fba6 | 8 | private ByteBuffer sendResponse( String status, String mime, Properties header, String response )
{
if ( status == null )
throw new Error( "sendResponse(): Status can't be null." );
StringBuffer buffer = new StringBuffer();
buffer.append("HTTP/1.0 " + status + " \r\n");
if ( mime != null )
buff... |
29396ade-f782-4c7e-8ea2-64ff4c743085 | 4 | private static void buttonMathActionsSettings(final JButton button) {
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String text = textField.getText();
if (text.contains("+") || text.contains("-")
|| text.contains("*") || text.contains("/")) {
... |
4e125d8d-2578-4c5f-805b-d4cf9e92af0b | 8 | public void render(GameContainer gc, Graphics g) {
Point temp = new Point(0, 0);
drawEdge(g, 0, 1);
drawEdge(g, Constants.GAME_WIDTH - 1, 1);
/*
* Draw tiles with scaling - focused on the player.
*/
for (int x = xPosition - VIEW_RANGE; x < xPosition + VIEW_RANGE; x++) {
for (int y = 0; y < lvlHeight... |
c3f24816-d4fc-4ad2-9bc9-88160c7f2748 | 1 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("<");
for(PathSegment pathSegment : path) {
sb.append(pathSegment.toString());
}
sb.append(">");
return sb.toString();
} |
47091e6d-7a82-407f-845d-57d22303b469 | 6 | public static void printMessage(Message message)
{
try
{
// Get the header information
String from = ((InternetAddress) message.getFrom()[0])
.getPersonal();
if (from == null)
{
from = ((InternetAddress) message.getFrom()[0]).getAddress();
}
System.out.println("FROM: " + from);
String... |
f386c560-3fcc-48a1-8b81-b4f98ff9afde | 3 | public Map<String,Integer> getdata(){
try{
// br.readLine();
/*while((strline=br.readLine())!=null){
String[] s = strline.split("[-: ]+");
System.out.println(s[0] + ":" + s[1]);
}*/
while((strline=br.readLine())!=null){
String[] s = strline.split("[-: ]+");
// s[0]:年, s[1]:月, s[6]:题号;
... |
85b280b0-d851-40ed-b782-9235d271b815 | 8 | @Override
public void remove(String str)
{
skipListNode s = head;
skipListNode[] newSkip = new skipListNode[maxLevel + 1];
for (int i = level; i >= 0; i--)
{
while (s.next[i] != null && s.next[i].data.compareTo(str) < 0)
{
s = s.next[i];
} // while
... |
bd9aafc1-2b51-483e-8f84-e551ebe9bb4e | 5 | public void step(float delta) {
camera.step(delta, girl.getPosition(), 0.05f);
getWorld().step(delta / 1000, 8, 3);
girl.step();
if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
girl.walkRight();
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
girl.walkLeft();
}
if ((Keyboard.isKeyDown(Keyboard.KEY_SPACE) ... |
9e9a99d5-8696-4725-91a2-0881c039c15f | 9 | private void loadFloorInfo(String wFNm)
/*
* The format of the input lines are: image <name> // the name of the floor
* GIF numTiles x y // number of tiles in the x- and y- directions dimTile w
* h // the width and height of a single tile evenRow x y // start of first
* even row oddRow x y // start of first od... |
b5d84e7b-5256-476f-a5e1-7b4efe5b297d | 6 | public void loadWorld(int id)
{
try {
File directory = new File("src/" + worldPath);
File[] fileList = directory.listFiles();
Map[] mapArray = new Map[fileList.length];
for(File file : fileList)
{
Map map = new Map();
try {
map.loadMap(new BufferedReader(new FileR... |
865a3b67-8452-4939-b090-7578107019d9 | 8 | private Map<Integer, Double> getRankedResourcesList(
int userID,
List<Map<Integer, Double>> userResourcesWeights,
boolean sorting) {
Map<Integer, Double> candidateResources = new LinkedHashMap<Integer, Double>();
// get candidates
int i = 0;
Map<Integer, Double> sortedNeighbors =
Utilities.g... |
427b96d9-58e5-4d2d-b4d1-72b512fa6846 | 5 | @Override
protected Object getColumnValue(SoldItem item, int columnIndex) {
switch (columnIndex) {
case 0:
return item.getId();
case 1:
return item.getName();
case 2:
return item.getPrice();
case 3:
return item.getQuantity();
case 4:
return item.getSum();
}
throw new IllegalArgumentExcep... |
9961e7d7-4703-42df-80e6-ca1d775d0975 | 0 | public static void main(final String[] args) {
Hashtable<Character,Integer> dist = new Hashtable<Character,Integer>();
dist.put('A', 23);
dist.put('C', 17);
dist.put('E', 19);
dist.put('S', 3);
System.out.println(dist);
Huffman<Character> huff = new Huffman<Character>(dist);
System.out.println(huff);
... |
fd259e38-d8ef-4387-ac87-5a9ffa802720 | 3 | Token read() {
if (!selfClosingFlagAcknowledged) {
error("Self closing flag not acknowledged");
selfClosingFlagAcknowledged = true;
}
while (!isEmitPending)
state.read(this, reader);
// if emit is pending, a non-character token was found: return any ... |
9da88a41-2089-4aa0-bd77-668ebacbf4cd | 0 | @Test
public void runTestLocationLeak3() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_LocationLeak3.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size()); // loc + lat, but single parameter
} |
d7c84e2c-2baf-4d30-b05b-9dcbb1b87de4 | 4 | public boolean removeTeleporter(String name) {
if (!this.teleporters.containsKey(name))
return false;
//Event
RemoveTeleporterEvent event = new RemoveTeleporterEvent(this.getTeleporter(name));
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return false;
//Check
for (Entry<Playe... |
83e0185a-215c-47be-9d7a-2925d6feab57 | 8 | private static void diffImages(BufferedImage goodImage, PixImage studentPixImage) {
BufferedImage studentImage = ImageUtils.pixImage2buffer(studentPixImage);
int diffCount = 0;
System.out.println("The difference is:");
if (studentImage.getWidth() != goodImage.getWidth()) {
System.out.println("The ... |
0f40b94c-a3b7-4cee-a1cb-8ee9039e915c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Trip other = (Trip) obj;
if (routeId == null) {
if (other.routeId != null) {
return false;
}
} else if (!routeId.eq... |
ae551ae3-e94b-4458-b10c-34f9b7629881 | 1 | public void setAnnounceInterval(int interval) {
if (interval <= 0) {
throw new IllegalArgumentException("Invalid announce interval");
}
this.announceInterval = interval;
} |
b63b039f-ebaf-4133-8c1e-8b40d2b02184 | 1 | public boolean isConstructor() {
Symbol sym = getReturn().getVariable();
return sym != null && initName.equals(sym.get());
} |
7113e9c3-b273-4751-9d40-9a624e0fceed | 4 | public String crypt(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("Error");
}
digester.update(str.getBytes());
byte[] hash = digester.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < hash.le... |
7beed165-43a3-49a2-8fe5-5420b5a1d43d | 2 | public boolean isModerator(User user){
for (int i = 0; i < moderators.size(); i++) {
if(moderators.get(i) == user) return true;
}
return true;
} |
054afd2c-0c6c-4d00-838b-b0bcbcac7a4e | 9 | private int readMultipleBytesSingleElement(byte[] b, int off, int len) throws IOException {
int read, totalRead = 0;
switch (state) {
case NEW_HEADER:
readNewHeader(); //fallthrough
case PROCESS_TAG: {
read = readHeaderBytes(currentHeader... |
51812c3b-5eba-4033-a0c0-5a8ff1635cc9 | 1 | public boolean fun() {
if(fun >= FunLevel){return true;}
return false;
} |
33caed93-efc3-4a68-81bd-5f6e320418a2 | 8 | public void run() {
links.add(baseURL);
ParserGetter kit = new ParserGetter();
HTMLEditorKit.Parser parser = kit.getParser();
while (!links.isEmpty() && mailto.size() + urls.size() <= 2000) {
try {
String href = links.remove(0);
URL url = null;
if (visited.contains(href) || href.startsWith("mai... |
1836a6d4-3991-4384-9fd4-0bf0cc14346f | 3 | private float limit(float eq)
{
if (eq==BAND_NOT_PRESENT)
return eq;
if (eq > 1.0f)
return 1.0f;
if (eq < -1.0f)
return -1.0f;
return eq;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.