method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
84057aa6-86c4-47b4-9fbc-a0d09a218cdc | 0 | static public Id3PictureType getDefaultType() {
return Id3PictureType.types[defaultTypeId];
} |
349071cf-99cf-4e50-81ac-c9a58d2381e4 | 5 | public void tick()
{
super.tick();
if(Keyboard.isKeyDown(Keyboard.KEY_T) && !tPressed)
{
tPressed = true;
if(onDeath(DamageType.generic, 100))
{
die();
}
}
if(!Keyboard.isKeyDown(Keyboard.KEY_T) && tPressed)
... |
89e3bb7b-1360-443f-ac05-e51ea4cb63ca | 1 | @Override
public int registerPacketHandler(IPacketHandler iph) {
log.finer("Registering a PacketHandler");
synchronized(PHList) {
if(!PHList.contains(iph)) {
PHList.add(iph);
}
return PHList.indexOf(iph);
}
} |
f0fb3f59-6d33-43d6-8970-82b2ef4fc957 | 6 | public void render(int xOffset, int yOffset) {
for (int y = 0; y < height; y++) {
int yp = y + yOffset;
if(yp < 0 || yp >= height) continue;
for (int x = 0; x < width; x++) {
int xp = x + xOffset;
if(xp < 0 || xp >= width) continue;
pixels[xp + yp * width] = Sprite.grass.pixels[(x & 15) + (y & 1... |
59057aad-5003-4244-bf93-0429cb53846a | 6 | protected void updateAction(boolean active) {
if (verbose) I.sayAbout(actor, "Updating action: "+progress) ;
if (finished()) {
oldProgress = progress = 1 ;
return ;
}
else {
oldProgress = progress ;
updateMotion(active) ;
}
if (inRange == 1) {
progress += 1f / (acti... |
e84e0a94-c8ab-43bf-a648-0b88d3dcb201 | 1 | private Integer parent(int pos) {
if(pos == 0) return null;
return pos /2;
} |
7cb9ef37-83b0-4bef-99d5-54eb7f25d96f | 7 | private boolean jj_3_8() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_23()) {
jj_scanpos = xsp;
if (jj_3R_24()) {
jj_scanpos = xsp;
if (jj_3R_25()) {
jj_scanpos = xsp;
if (jj_3R_26()) {
jj_scanpos = xsp;
if (jj_3R_27()) {
jj_scanpos = xsp;
if (jj_3R_28()) return true;
... |
5512354c-96af-406d-98bd-5dd2cc6bec4f | 2 | public void giveReward(UQuest plugin, Player player){
if(this.type.equalsIgnoreCase("money")){
plugin.getQuestInteraction().addMoney(player, this.howMuch);
}else
if(this.type.equalsIgnoreCase("item")){
player.getInventory().addItem(this.item);
player.sendMessage(ChatColor.YELLOW + "*You got " + this.item... |
74e931ae-c6d3-4400-8245-294871a8054a | 8 | public static void DoTurn(PlanetWars pw) {
//notice that a PlanetWars object called pw is passed as a parameter which you could use
//if you want to know what this object does, then read PlanetWars.java
//create a source planet, if you want to know what this object does, then read Planet.java
Planet... |
4f5574cb-ac4a-4059-b557-08d678e95813 | 8 | @Override
public void readSubscription() {
Properties prop = conf.getConfProps();
float tmp = lightSourceBrightness;
lightSourceBrightness = Float.parseFloat(prop.getProperty("lightSourceBrightness"));
if (Math.abs(tmp - lightSourceBrightness) > 0.001f) {
changeLight();
... |
f613fa18-d916-43fd-9435-54ce6dc23c52 | 4 | public void generate(Token t) throws Exception
{
REGroup g = new REGroup();
REGroup working = g;
int j = 0;
int i = 0;
for(j = 0; j < t.display().length() ; j++)
{
switch(t.display().charAt(i))
{
case '(' : i = j + 1; break;
case ')' : working.generate(t.display().substring(i, j), "");
... |
32dd7e34-93de-438d-af77-2e948397a24b | 8 | public static boolean isValidDateRange(String date) {
String[] dateParts = date.split("/");
int day;
int month;
int year;
if (date.equals("null")) {
return true;
}
try {
day = Integer.parseInt(dateParts[0]);
month = Integer.parseInt(dateParts[1]);
year = Integer.parseInt(dateParts[2]);
} ca... |
55fe4681-2572-4f97-a351-c25243a79e0e | 8 | public boolean processMessage(ServerMessage message, Connection sourceConnection) {
switch (message.getMessageType()) {
case REGISTER:
return registerService.serveRequest(message, sourceConnection);
case LOGIN:
case LOGOUT:
return authenticationService.serveRequest(message, sourceConnection)... |
9d6abd6f-115c-4499-a7b3-511878e66b29 | 4 | public void jFlush(int index) {
if (index < tail) {
for (int i = index++; i < tail; i++)
tuples[i] = null;
} else {
for (int i = index++; i < tuples.length; i++)
tuples[i] = null;
for (int j = 0; j < tail; j++)
tuples[j] = null;
}
} |
3d23a360-1cc7-43d2-8d5e-dd18c2efd5f5 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
f5dc6d51-2f9d-43db-818a-4388cc668c0f | 5 | public ShipLayout getShipLayout(String id) {
ShipLayout result = shipLayouts.get(id);
if ( result == null ) { // Wasn't cached; try parsing it.
InputStream in = null;
try {
in = getDataInputStream("data/"+ id +".txt");
result = dataParser.readLayout(in);
shipLayouts.put( id, result );
} catc... |
b1ee9d2d-5138-4691-8f4a-fb754db1ec02 | 5 | void load() {
// Parse file
if (fileName != null) {
if (verbose) Timer.showStdErr("Loading genes list from file '" + fileName + "'");
String lines[] = Gpr.readFile(fileName).split("\n");
if (lines.length <= 0) throw new RuntimeException("Cannot read file '" + fileName + "'");
for (String line : lines)... |
ecc942ff-dd0e-4778-b52d-df7c107580ab | 2 | private int getChar() throws IOException {
if (isBackedUp) {
isBackedUp = false;
return backedUpChar;
}
int result = reader.read();
if (isNewLine(result)) {
lineNumber++;
}
return result;
} |
bd402c9d-f014-481a-bd9b-6ee960ca2fac | 5 | public void startAnalyticsServer(String [] args) {
// start Executorservice
analServerExecutionService = Executors.newCachedThreadPool();
AnalyticsServerCmdListener cmdListener = new AnalyticsServerCmdListener(this);
analServerExecutionService.execute(cmdListener);
// read args
try {
bindingName... |
aed30988-a22c-43b8-b1c0-bbe8ace1c0be | 2 | public static byte[] encrypt3DES(byte[] message, String encrKey)
{
try
{
final MessageDigest md = MessageDigest.getInstance("md5");
final byte[] digestOfPassword = md.digest(encrKey.getBytes("utf-8"));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);... |
79bff7c1-f6b4-4ec4-8b26-105ff1c98fdd | 1 | public void testWithField_nullField() {
MonthDay test = new MonthDay(9, 6);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
32f23c66-328b-4ba5-b48c-b5e3e13e7d8a | 8 | BottomBar(JmolContainer c) {
super(new FlowLayout(FlowLayout.LEFT, 0, 1));
setBorder(BorderFactory.createRaisedBevelBorder());
container = c;
int m = System.getProperty("os.name").startsWith("Mac") ? 6 : 2;
Insets margin = new Insets(m, m, m, m);
toFirstButton = new JButton(new ImageIcon(getClass().getR... |
9d9de7e4-cee2-409e-8df2-813ee6aec3c1 | 8 | static final String method1488(Interface anInterface, int i, int j) {
if (!Client.method39(anInterface).method1515(j, (byte) 125)
&& anInterface.anObjectArray1352 == null) {
return null;
}
if (i < 110) {
return null;
}
if (anInterface.com... |
ffa7ab13-2f23-4ff9-9d0e-a03f23d5b2e2 | 6 | public void run() {
Random random = new Random(this.hashCode());
random.setSeed(System.currentTimeMillis()); // comment out for determinstic
intSet.threadLocalInit();
boolean toggle = true;
try {
while (true) {
boolean result = true;
element = random.next... |
8ff42e9b-b895-429a-a0a8-339491825e5a | 3 | public boolean remove(int target)
{
int index; // The location of target in the data array.
// First, set index to the location of target in the data array,
// which could be as small as 0 or as large as manyItems-1; If target
// is not in the array, then index will be set equal to ma... |
95bcdd02-3b77-4015-9c0f-d3d40c0a4ed2 | 1 | @Override
public void update(GameContainer container, StateBasedGame sbg, int delta) throws SlickException {
xpos = container.getInput().getMouseX();
ypos = container.getInput().getMouseY();
if(mousePress){
enterMenuState(sbg);
mousePress =false;
StartMenu.mousePress = 0;
}
} |
bda8926b-c298-4c5d-9046-22631c02213b | 0 | public void setRosas(int rosas) {
this.rosas = rosas;
} |
c21aded6-f96d-466a-9e1e-8f5d24a6c233 | 5 | private void moveBullet()
{
if(moving) {
if(direction == PlayerDirection.LEFT)
{
x = x - movementSpeed;
}
if(direction == PlayerDirection.RIGHT)
{
x = x + movementSpeed;
}
if(direction == PlayerDirection.UP)
{
y = y - movementSpeed;
}
if(direction == PlayerDirection.DOWN)
... |
24b75600-90fb-4761-bf3b-e6aee95b120f | 8 | @Override
public final void execute() throws InterruptedException {
try {
while (!stop) {
if (socket == null && se.offer(this, se.lingerTimeMs)) {
socketAvailable.acquire();
}
if (socket == null) { if (!stop) stop = (se.getWorkerAmount() > se.minWorkers); continue; }
if (!isValidSocket()) ... |
4d94e8dd-a869-4da7-bd2e-e6e6581028ab | 7 | @Override
public void Execute(BotMain bot, String channel, String sender, String login, String hostname, String message, String[] param) {
if(param[1].trim().equals("name"))
{
if(!param[2].trim().equals(""))
{
bot.SetNick(param[2].trim());
}
... |
94c629fd-a137-4ca9-beb5-9f2cf3c4bfa6 | 8 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.averageGroundLevel < 0... |
c3a147e8-c5ec-440e-b867-26e1b7407299 | 7 | private Model getModel(int modelType, int modelId) {
Model model = (Model) modelCache.get((modelType << 16) + modelId);
if (model != null)
return model;
if (modelType == 1)
model = Model.getModel(modelId);
if (modelType == 2)
model = EntityDefinition.getDefinition(modelId).getHeadModel();
if (modelTy... |
03f77b1d-80c4-4f98-bf43-062d307d36a2 | 6 | public static Keyword cutSpecialist(ControlFrame frame, Keyword lastmove) {
lastmove = lastmove;
if (((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null))) == null) {
KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, Logic.EMPTY_PROPO... |
f30adcb3-63d5-4cae-9fcb-3ee893bd380a | 7 | private float printLine(GraphicRenderer g2, Position lastpos, Position pos, float zpos, float time,long starttime,boolean travel) {
float x1 = Math.min((lastpos.x + Xoffset) * zoom,bedSquareZoomed);
float y1 = (bedSquare/extrazoom * zoom) - ((lastpos.y + Yoffset) * zoom);
float x2 = Math.min((pos.x + Xoffset) * ... |
1431efe8-3541-4d29-8fdf-8dbdd2a14b53 | 1 | public Set getMemberNames() {
if (members == null)
return null;
else
return members.keySet();
} |
76f25dbe-a1b8-457d-a89c-940c77186399 | 1 | public String getData(String artistName) throws IOException {
String requestLink = null;
try {
requestLink = geberateRequestLink(artistName);
} catch (EncoderException ex) {
throw new IOException(ex);
}
String response = sendRequest(requestLink);
s... |
cba3941a-6ee1-4600-a746-65a4058918f2 | 6 | private ArrayList<Mod> processModFile(ModFile modFile, ModPack modPack) {
ArrayList<Mod> mods = new ArrayList<>();
String result;
HashSet<String> identifiedIDs = new HashSet<>();
if(modFile.IDs.getSize() > 0) {
for(int i=0; i<modFile.IDs.getSize(); i++) {
result = checkID(modFile.IDs.get(i), modPack);
... |
1e21a5ac-2413-4adc-8e48-672ad51a603c | 3 | public static UrlShortener createUrlShortener(String serviceName,
final Map<String, String> accountCredentials) {
if (serviceName == null) {
throw new IllegalArgumentException("service name cannot be null");
}
String serviceNameClean = serviceName.toLowerCase().replace(".", "");
if (serviceNameClea... |
307121bf-61f7-403d-b017-8f67351a5c42 | 1 | private AFUNIXSocket ( final AFUNIXSocketImpl impl ) throws IOException {
super(impl);
try {
NativeUnixSocket.setCreated(this);
}
catch ( UnsatisfiedLinkError e ) {
e.printStackTrace();
}
} |
59208ee4-04e6-49c8-a450-2c6e5d867250 | 3 | @Override
public void deserialize(Buffer buf) {
fightId = buf.readInt();
if (fightId < 0)
throw new RuntimeException("Forbidden value on fightId = " + fightId + ", it doesn't respect the following condition : fightId < 0");
int limit = buf.readUShort();
attackers = new Ga... |
e28afb6d-0ed4-42ea-ad90-d9e0efa48f55 | 4 | public void setHeigth(int height) {
if(rotation == 0 || rotation == 180){
if(zoom == 1){
this.height = (int) (height/zoom);
}else{
this.height = (int) (height/zoom)+1;
}
}else{
if(zoom == 1){
this.width = (int) (height/zoom);
}else{
this.width = (int) (height/zoom)+1;
}
}
} |
62e1fe24-2914-4e7c-add6-50ca51bc886e | 9 | public ArrayList<String> fullJustify(String[] words, int L) {
ArrayList<String> res = new ArrayList<String>();
if (words.length == 0)
return res;
ArrayList<String> tmp = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
int cur = 0;
int len = 0;
while (cur < words.leng... |
8caa8834-85a8-4a68-9933-6e091e3f92d2 | 2 | private Version showVersionDialogue(){
String[] choices = new String[Version.values().length];
for (int i = 0; i < Version.values().length; i++){
Version version = Version.values()[i];
choices[i] = version.getMessage();
}
Version versionChoice = Version.getFromM... |
28e4f417-4064-4a87-8a91-50110ee1b5f7 | 1 | private boolean contactExists(Contact contact) {
if(allContacts.contains(contact)) {
return true;
} else {
return false;
}
} |
992d4873-bb5d-4514-a75d-ea073f24d024 | 1 | public Map() {
for (int i = 0; i < 127; i++) {
map.add(0);
}
} |
678d27a1-876d-4a87-8cb5-bdcbc8387139 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean commanate = false;
Iterator keys = this.keys();
writer.write('{');
while (keys.hasNext()) {
if (commanate) {
writer.write(',');
}
... |
6d6eea4b-60fd-4c82-bc8f-0ce8456c01c5 | 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... |
561a737b-91b3-43b9-8849-e77e0a0de246 | 7 | private MouseAdapter treeMouseController() {
return new MouseAdapter () {
@Override
public void mouseClicked(MouseEvent event) {
JTree tree = (JTree) event.getSource();
TreePath selectionPath = tree.getPathForLocation(event.getX(), event.getY());
if (selectionPath != null) {
selectedA... |
db0f1299-5d8d-491d-9f12-2730fc7f6102 | 1 | public E top() {
if ( this.isEmpty() ) {
throw new EmptyHeapException();
}
E oldTop = heap[TOP];
heap[TOP] = heap[size - 1];
heap[size - 1] = null;
size--;
fixHeap( TOP );
return oldTop;
} |
949562c2-cb14-4f86-900d-e5cc50ed957a | 0 | public List<GeoJsonObject> getGeometries()
{
return geometries;
} |
9760d44b-09ca-4822-a7b6-0839e61cfdb9 | 8 | public static void printIncorrectClusters(CorefModel model,
CorefInput input, CorefOutput correct, CorefOutput predicted) {
Map<Integer, ? extends Set<Integer>> explicitClusteringCorrect = createExplicitClustering(correct);
Map<Integer, ? extends Set<Integer>> explicitClusteringPredicted = createExplicitClusteri... |
b480d1ce-7fdd-4868-8879-dcf3ebd37e4a | 0 | public void setHoraspraticas(Tempo horaspraticas) {
this.horaspraticassemanais = horaspraticas;
} |
22a0d1dc-0c56-48a5-a705-138bca46e7df | 4 | public static boolean checkNumbers(Integer i, Integer j) {
char[] base = i.toString().toCharArray();
char[] comp = j.toString().toCharArray();
for (char b : base) {
boolean t = false;
for (char c : comp) {
if (b == c) t = true;
}
i... |
e1487f24-3577-416d-9f97-a17baf6fa7d1 | 8 | public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(new FileInputStream("/home/hd/sgu/list.txt"));
while (scanner.hasNext()) {
String fileName = scanner.nextLine();
if (fileName.endsWith("/_file") ||
fileName.equals("_fi... |
79ac8205-0eef-4263-9d84-690c75ca8955 | 1 | public boolean cardExpired()
{
if(turnDecay == 0){return true;}
return false;
} |
6f43e568-84db-41f7-b4ce-ae5d36a742c6 | 8 | final public void Arithmetic_expression() throws ParseException {
/*@bgen(jjtree) Arithmetic_expression */
SimpleNode jjtn000 = new SimpleNode(JJTARITHMETIC_EXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Ad... |
b9de7236-80bf-4723-b923-b7b093f9e321 | 7 | public void play() {
//si on est connecté on lance une partie avec un autre joueur
if (isConnected) {
try {
Game game = factory.getCurrentGame(player);
// s'il n'a pas de partie en cours on cherche un adversaire libre
if (game == null) {
... |
2d0191c4-9cec-4078-bb36-78101c580e2a | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
8f4c73b0-aec0-48ed-b77c-9765be795180 | 1 | public Map<String, Object> getSymbols() {
Map<String, Object> symbolsAndValues = new HashMap<String, Object>();
for (Map.Entry<String, Binder> e : symbols.entrySet()) {
symbolsAndValues.put(e.getKey(), e.getValue().getValue());
}
return symbolsAndValues;
} |
3c295291-cde0-46d8-9296-da9478622f37 | 5 | public void createChatroom(String userMsg) {
Message ccrMsg;
if (userMsg.length() == 0) {
String ccrName = ""; // because no chat room name
try {
ccrMsg = msgFactory.createMessage("ccr", ccrName);
producer.send(ccrMsg);
} catch (JMSException e) {
// TODO Auto-generated c... |
57eedb09-a889-47db-9b85-4be9571fc24e | 3 | public void check() {
if(!started){ com.start(); started = true;}
// TODO Auto-generated method stub
if(com.getPressureSwitchValue() != currentState){
if(!(currentState = com.getPressureSwitchValue()))
com.setRelayValue(Relay.Value.kOn);
else
com.setRelayValue(Relay.Value.kOff);
}
} |
865f22a0-9ea3-49ed-ad46-679b47bbeb7d | 0 | public String getId() {
return id;
} |
8b17a692-1792-469c-a9fb-89bb3afae16e | 3 | @Override
protected List<ByteBuffer> onRelease()
{
ByteBuffer buffer;
List<ByteBufferStack> stacks = new ArrayList<ByteBufferStack>();
List<ByteBuffer> buffers = new ArrayList<ByteBuffer>();
// Acquire lock to avoid concurrent adds and fills
synchronized (writeLock)
{
Iterator<Entry<Integer, ByteB... |
64933b68-3a5d-49c7-8e75-6442f092cd5e | 0 | public int getNorth(){
return this.north;
} |
23a9307f-3b09-4547-84b7-49aa80a8a542 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CommentModel that = (CommentModel) o;
if (idComment != that.idComment) return false;
if (postId != that.postId) return false;
if (userI... |
73679f07-4682-4622-b6f5-8d9a31b7f431 | 2 | public void itemStateChanged(ItemEvent e) {
CPArtwork artwork = controller.getArtwork();
Object source = e.getItemSelectable();
if (source == cbSampleAllLayers) {
artwork.setSampleAllLayers(e.getStateChange() == ItemEvent.SELECTED);
} else if (source == cbLockAlpha) {
artwork.setLockAlpha(e.getStateChange... |
383d4099-3f6d-4241-839a-ef7efee1ceaa | 8 | public void createChunkFromBounds(GameBoard theBoard, int lowerBound, int upperBound, boolean clearChunk) {
if (isEmptyChunk(lowerBound, upperBound))
return;
int numCols = theBoard.getCols();
//Two versions of the loop for maximum efficiency. This is better than checking the clearChunk
//value for each... |
3bf60965-2bf3-47c8-b1f1-ace973b41ac5 | 2 | public void show() {
StringBuffer report = new StringBuffer();
for(Slot<String> s : theDraft.copy()) {
report.append(s.pickId);
report.append(" ");
if (Slot.BasicStates.USED.equals(s.state)) {
report.append(s.player);
} else {
... |
bfed9e33-2fa3-43e6-8a0b-f0f013b2c674 | 7 | public static void main(String args[]) {
// The default port number.
int portNumber = 4444;
if (args.length < 1) {
System.out.println("Usage: java MultiThreadChatServerSync <portNumber>\n"
+ "Now using port number=" + portNumber);
} else {
portNumber = Integer.valueOf(args[0]).int... |
9a5cbc1b-fb4b-4c66-84f5-bb2c1d8b0d9a | 8 | public void run() {
try {
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
final int bytesRead = m_in.read(buffer, 0, BUFFER_SIZE);
if (bytesRead == -1) {
break;
}
final byte[] newBytes =
m_filter.handle(m_connectionDetails, buffer, bytesRead);
m_outputWriter.flush();
if (n... |
0477ad0f-5045-4cd9-bd0d-328f4cee6c2d | 7 | @Override
public double[] getDirection(SpaceObject FROM, SpaceObject TO)
{
final double[] dir=new double[2];
final double x=TO.coordinates()[0]-FROM.coordinates()[0];
final double y=TO.coordinates()[1]-FROM.coordinates()[1];
final double z=TO.coordinates()[2]-FROM.coordinates()[2];
if((x!=0)||(y!=0))
{
... |
907d1448-4daa-489d-b572-523913a56211 | 4 | public static boolean save(ZMsg msg, DataOutputStream file) {
if (msg == null)
return false;
try {
// Write number of frames
file.writeInt(msg.size());
if (msg.size() > 0 ) {
for (ZFrame f : msg) {
// Write byte size of... |
ec3638af-f54a-4e06-84ac-f807c5319015 | 1 | private static Map<Integer,Integer> initMap(int []a){
Map<Integer, Integer> map = new HashMap<Integer,Integer>(a.length);
for(int value : a){
map.put(value,1);
}
return map;
} |
f8cd7ba2-15a7-41ff-9091-d53af8b4c82d | 5 | private void initShortMsgFontMenu(Color bg) {
this.shortMsgPanel = new JPanel();
this.shortMsgPanel.setBackground(bg);
this.shortMsgPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
String initFontTmp = this.skin.getShortMessageFont();
int initFontSizeTmp = this.skin.... |
6c4fda06-ecdd-40fb-baa1-3bdd7b1d4530 | 3 | private static int initOriginal(final Display display, Composite inComposite) {
final Composite originalCompsite = new Composite(inComposite, SWT.BORDER);
int heightHint = 0;
try {
original = new Image(display, Resource.class.getResourceAsStream(IMAGE_PATH));
if (original.getImageData().depth != 8 && orig... |
f210187e-615d-4088-8f6f-0c2e899fe80e | 6 | public byte[] read(InputStream is) throws IOException
{
byte[] readBuf = new byte[bufSize];
int totalRead = 0;
int hdrEndIdx = 0;
byte[] leftoverBuf = null;
byte[] headerBuf = new byte[bufSize];
int headerBufRead = 0;
int read;
System.out.println("");
Log.i(LOG_TAG, "read started");
w... |
6427c0ed-d53e-4a5c-97b2-9140c746280d | 0 | public FSAAlphabetRetriever() {
} |
e7326573-41f0-4220-b4da-af8f1297ec1c | 7 | public static ArrayList<Node> extractParameters(Node node) {
ArrayList<Node> parameters = new ArrayList<Node>();
if (node.getToken() != null
&& (node.getToken().getType() == TokenType.KW_LET
|| node.getToken().getType() == TokenType.KW_LET_STAR
|| node.getToken... |
19e02043-9825-409a-9648-65b39588d393 | 0 | @Test
public void EnsureTrailingSlashIsRemoved() {
String path = "x/y/";
String newpath = Path.trimSlashes(path);
assertEquals("x/y", newpath);
} |
8940c656-4344-4045-8a8a-8667a719c584 | 1 | static final int Mix7To1(final int c1, final int c2) {
//return (c1*7+c2)/8;
if (c1 == c2) {
return c1;
}
return ((((c1 & Mask2) * 7 + (c2 & Mask2)) >> 3) & Mask2) |
((((c1 & Mask13) * 7 + (c2 & Mask13)) >> 3) & Mask13) |
((((c1 & Mask4) >> 3) * 7 + ((c2 & Mask4) >> 3)) & Mask4);
} |
7b7bd868-5c0f-4536-a713-8e701daa8ee8 | 5 | private void handleJoinCommand(String[] split) throws IOException {
if (!joined) {
try {
String password;
String name;
if (split.length == TWO) {
name = split[1];
password = "";
} else if (split.l... |
f1692516-ac3c-4aa2-9fa1-cc6d302f3bc4 | 4 | private void destroyAllMissiles() {
for (EnemyMissile enemy_Missile : missileQueue) {
if (!(enemy_Missile.getMode() == EnemyMissile.Mode.Launched))
enemy_Missile.setIsAlive(false);
}
for (EnemyMissile enemy_Missile : allMissiles) {
if (!(enemy_Missile.getMode() == EnemyMissile.Mode.Launched))
enemy_... |
b04ce768-af52-4540-816a-ddc70cc13410 | 7 | public Automato determinizaAutomato(Automato automato) {
Automato determinizado = new Automato(automato.getNome(), automato.getDescricao());
List<Estado> allEstados = automato.getEstados();
if (isAutomatoDeterministico(automato)) {
return automato;
}
for (Estado estado : allEstados) {
if (estado.isNa... |
28bbfcd9-6c45-4842-8cbb-b384a56f7778 | 3 | public String[] getAvailableLanguages()
{
List<String> languages = new ArrayList<>();
String langDir = "i18n";
if (GuiUtil.resourceExists(langDir))
{
for (String res : GuiUtil.getResources(langDir))
{
if (res.endsWith(".xml"))
... |
0f3b3f2f-e5e1-4ab5-8b2b-ef5f6a87c37b | 3 | public String createWeatherString(String type) {
String result = "";
DefaultHttpClient httpclient = new DefaultHttpClient();
try {
HttpHost target = new HttpHost("query.yahooapis.com", 80, "http");
String query = "/v1/public/yql?q=select%20item%20from%20weather.forecast%2... |
3fb8951f-952a-4b3a-aaec-7c4e1b535c30 | 1 | public static void generateImageEdge(float gaussianKernelRadius,
float lowThreshold, float highThreshold, int gaussianKernelWidth,
boolean contrastNormalized) throws IOException {
Image image = ImageIO.read(new File(MainActivity.IMAGE_ORIGINAL));
BufferedImage bufferedImage = new BufferedImage(image.getWidth... |
403432e2-0e0c-485c-ba10-f3b9973c6bd4 | 3 | public void removeFilter(Class<? extends Filter> clazz)
{
Iterator<Filter> it = filters.iterator();
while (it.hasNext())
{
if (it.next().getClass().equals(clazz))
{
it.remove();
}
}
} |
108dbdb2-9f56-45b7-8936-0854cccb6569 | 1 | public static void main(String[] args) {
ForkJoinPool forkJoinPool = new ForkJoinPool(4);
forkJoinPool.execute(new ForkJoinTaskImageLoader(1, "http://chudesa-mira.ru/uploads/images/00/00/21/2011/11/17/872999.jpg"));
forkJoinPool.execute(new ForkJoinTaskImageLoader(2, "http://unnatural.ru/wp-cont... |
a1a39cdc-f3a3-44e5-bbe7-41fd0ace1c59 | 8 | public void setRegion(int left, int top, int width, int height) {
if (top < 0 || left < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (height < 1 || width < 1) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int right = l... |
a7d7764c-cb93-4ab5-8ac5-e11714ae9897 | 5 | public void mouseClicked(MouseEvent e) {
//if (e.getClickCount() == 2 && !e.isConsumed()) {
if(e.getButton()==MouseEvent.BUTTON3){
//e.consume();
Color color=last;
color =
JColorChooser.showDialog( this,
"Choose a color", color )... |
5b398385-fd25-4141-9b05-482411510d93 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
a22a37b1-c22f-4ac5-9014-93fd9e5a5f88 | 0 | InTestLinkLogRunListener(final Logger logger, final URI testlinkUri) {
this.logger = logger;
this.uri = testlinkUri;
this.testLinkUriResolver = new TestLinkUriResolver(testlinkUri);
} |
6a858585-6a5d-402b-838a-dcc25b2b87da | 2 | public static byte[] createChecksum(String filename) throws Exception {
InputStream fis = new FileInputStream(filename);
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
if (numRead > 0) {
complete.update(buffe... |
b6cb53c1-cd88-46e3-b41f-aca120a5d774 | 3 | @Override
public void run()
{
while(true)
{
try
{
Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 1000);
if (!Agent.getConflictExists())
Agent.checkBugs(agentId, agentType);
else Thread.sleep(10000);
} catch (InterruptedException e) {
System.out.println(... |
444df05a-d564-4cbe-a1da-180a75605133 | 8 | private static Level string2Level(String s) {
if(s.trim().toUpperCase().equals("ERROR")) return ERROR;
if(s.trim().toUpperCase().equals("WARNING")) return WARNING;
if(s.trim().toUpperCase().equals("CONFIG")) return CONFIG;
if(s.trim().toUpperCase().equals("INFO")) return INFO;
if(s.trim().toUpperCase().equals... |
c1f5be57-c35d-4c7b-9759-5349f24d806e | 6 | private boolean openNextFile() {
try {
if (compressionInput!=null) {
compressionInput.close();
} else if (currentFile!=null) {
currentFile.close();
}
currentFile=null;
compressionInput=null;
currentFilePath++;
if (currentFilePath >= filePathList.length) { r... |
de6e95da-1ee0-48dc-a0c7-e522a8f050d3 | 4 | public void mutate(){
switch(random.nextInt(4)){
case 0: mutateOrdering(); break;
case 1: mutateWord(); break;
case 2: deleteWord(); break;
case 3: addWord(); break;
}
} |
21317d07-508f-45fb-9160-62acdcbcc07b | 7 | @Override
public void onLoad(OnLoadCallback pOnLoadCallback) throws Exception {
final Font defaultFont32 = ResourceManager.getInstance().getDefaultFont32();
// Username
this.mUserNameLabel = new Text(LoginLayer.PADDING_DEFAULT,
LoginLayer.PADDING_DEFAULT * 4, defaultFont32, ... |
9d013acb-24a4-416f-990e-c534d64ca703 | 7 | public boolean setElement(int index, E element) {
if (indexOK(index)) {
array[index] = element;
if (index > lastPos && element != null) {
lastPos = index;
} else if (index == lastPos && element == null) {
while (array[lastPos] == null && last... |
4ccacb14-3a21-4ab3-995d-7a5339ddb677 | 8 | @Override
public final void loadMap(final File mapToLoad,
final DndPluginCaller.LoadedMapEntry c) {
final InputStream in = this.io.openIn(mapToLoad);
in.registerProgressMonitor(this.io);
class ParseState {
private int state;
final boolean comment() {
return this.state < 0;
}
final void parse... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.