method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
03047b21-6a3f-443f-860e-76c43ff30c3e | 5 | private static void doCopyRecursively(File src, File dest) throws IOException {
if (src.isDirectory()) {
dest.mkdir();
File[] entries = src.listFiles();
if (entries == null) {
throw new IOException("Could not list files in directory: " + src);
}
for (File entry : entries) {
doCopyRecursively(en... |
2b40a91d-1f7d-4aae-8fc7-cad2ef204eed | 5 | public boolean match(Sim_event ev)
{
if (ev == null) {
return false;
}
boolean result = false;
try
{
// find an event with a matching tag first
if ( tag_ == ev.get_tag() )
{
Object obj = ev.get_data();
... |
0204a661-c4f6-4921-82c5-50e433b1f93f | 0 | public void setAddress(int address) {
this.address = address;
} |
d1518d9b-c342-4c45-8174-a25bb7e88db1 | 4 | public static byte[] getBytesFromFile(File file) throws IOException {
// Get the size of the file
long length = file.length();
if (length > Integer.MAX_VALUE) {
// File is too large
throw new IOException("File is too large!");
}
// Create the byte array to hold the data
byte[] bytes = new b... |
3d57aecb-ad8b-4f1b-897e-817d11bb0c14 | 9 | private boolean set(Object object, String fieldName, String fieldValue) throws IllegalArgumentException, IllegalAccessException {
Class<?> clazz = object.getClass();
while (clazz != null) {
try {
Field field = clazz.getDeclaredField(fieldName);
String type = f... |
86c383cb-9a49-42df-a7dd-ab77028fc818 | 5 | public static RiverDB readCSV (String fName) {
riverDB = new RiverDB ();
LabeledCSVParser lcsvp = null;
try {
lcsvp = new LabeledCSVParser(
new CSVParser(
new FileReader( fName )
)
);
try {
while(lcsvp.getLine() != null){
System.out.println(
... |
2f89ce46-6b0f-4f03-b74f-b3fc50d39887 | 7 | protected double getEdgeDistanceFromEdge(int i)
{
double energy = 0.0;
// This function is only performed during fine tuning for performance
if (isOptimizeEdgeDistance && isFineTuning)
{
for (int j = 0; j < v.length; j++)
{
// Don't calculate for connected nodes
if (e[i].source != j && e[i].targe... |
944d73f7-bff8-4c83-8786-2a1a334f2532 | 4 | @Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
Sprite sprite = null;
if (currentTool == Tool.SPRAY) {
super.mouseClicked(e);
sprite = new SpraySprite(e.getX(), e.getY(), 1, 100, Col... |
4ffdb1c0-a6a1-4178-90f8-62f2a1de998a | 3 | private static void activateSubmitTaskHTML(Request request, Response response) {
boolean submitResult = false;
Task newTask = new Task();
if (parsAndSetNewTask(newTask, request)) {
if (DBHandler.addTask(newTask)) {
submitResult = true;
}
}
if (submitResult) {
response.setRedirect("/smtp/tasks.h... |
abb72656-b96f-4f2a-851d-bbcb36ef78d5 | 4 | public Currency[] search(String token){
ArrayList<Currency> list = new ArrayList<>();
for (Currency currency : this){
if (currency.getCode().equalsIgnoreCase(token))
list.add(currency);
else if (currency.getSymbol().equalsIgnoreCase(token))
list.ad... |
908c71e4-ed78-4ba3-9928-201dd052dccd | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
06d4b8c8-d3e2-47f2-842e-5eaad933f3d1 | 2 | @Override
public T validate(String fieldName, T value) throws ValidationException {
if (value == null) {
return null;
}
if (max.compareTo(value) < 0) {
throw new ValidationException(fieldName, value, "must be at most " + max);
}
return value;
} |
9f6b5d04-d639-4a37-8a0a-d278bea33aa3 | 5 | private void startMove(XY xy) {
int distance = -1;
Way selectedWay = null;
Set<Way> ways = model.getBoard().makePossibleWays(this);
for (Way way : ways) {
if (way.getLastPlace().equals(xy)) {
int price = way.getPrice();
if ((distance < 0) || (... |
87e46280-d32d-436c-bd0d-c395dab26d6e | 2 | protected void closeWrapper(AutoCloseable... acs){
for (AutoCloseable ac : acs ){
try { ac.close(); }
catch (Exception e) {
e.printStackTrace();
}
}
} |
6fbcf102-844b-43f9-8db7-cf5e542d89f6 | 5 | public static boolean isPrime(int x) {
if (x == 2) {
return true;
}
if (x % 2 == 0 || x == 1) {
return false;
}
for (int i = 3; i * i <= Math.abs(x); i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
} |
0fff745c-768d-47f1-b334-08914fc64e7e | 6 | @Override
public QualityDecoder createQualityDecoder() {
if (in == null)
return null;
// Mark Buffered input stream
in.mark(BYTE_TO_READ);
// Initialize new byte buffer
byte head[] = new byte[BYTE_TO_READ];
try {
// Reading bytes into the new buffer
in.read(head);
// Reset the buffer
in... |
a066532d-eda5-4d5d-957c-8227eddb57bb | 7 | private int findNearestPair(double key, double secondaryKey) {
int low = 0;
int high = m_NumValues;
int middle = 0;
while (low < high) {
middle = (low + high) / 2;
double current = m_CondValues[middle];
if (current == key) {
double secondary = m_Values[middle];
if (secondary == sec... |
df830327-9a64-49e8-92d4-3dec5dbdd3f0 | 9 | public void load() {
ResultSet res = null;
try {
res = db.selectQuery("SELECT * FROM servers ", new Object[0]);
Server s;
while (res.next()) {
s = (new Server(this)).bind(res);
servers.put(s.getId(), s);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
getDb().collect(null... |
18ba2711-e2d0-4b21-99e3-a91d060abe43 | 2 | private static void closeReader(Reader reader){
try{
if(reader != null){
reader.close();
}
} catch (IOException ex){
ex.printStackTrace();
}
} |
d18a993b-e0a1-4a8a-9fc4-1c64cfbb66e1 | 6 | public void initialize(ArrayList<SpriteBank> banks,
ArrayList<String> texturenames)
{
// If the map was already initialized, does nothing
if (this.initialized)
return;
// Initializes the tiledrawer
this.tiledrawer = new DrawableHandler(false, false, getDepth(),
this.parentdrawer);
// Create... |
d96528d7-6266-4ff5-bc42-54ab9dec3d8f | 1 | public void connect() throws IOException{
//Encrypt Text
Keyinput = Check.UpKey(keybox.getText());
if (Keyinput == "error"){
//Exit Method On Error
return;
}
//enable connection
isrun = true;
//start connection
Message = sendbox.getText().toString();
Encryption Encryption1 = new Encryption(Me... |
aa2d85e3-5aeb-45c6-8457-4f4d6f6dea5b | 9 | private void readSubframe(int channel, int bps) throws IOException, FrameDecodeException {
int x;
x = bitStream.readRawUInt(8); /* MAGIC NUMBER */
boolean haveWastedBits = ((x & 1) != 0);
x &= 0xfe;
int wastedBits = 0;
if (haveWastedBits) {
... |
47d6a643-2c7d-4773-8f62-74dc7c6c29f8 | 5 | public boolean type(char key, java.awt.event.KeyEvent ev) {
if ((key >= '0') && (key <= '9')) {
int opt = (key == '0') ? 10 : (key - '1');
if (opt >= menuOptions.length)
return true;
wdgmsg("cl", opt);
ui.grabkeys(null);
return (true);
} else if (key == 27) {
wdgmsg("cl", -1);
ui.grabkeys(n... |
148ebf7a-97af-4545-8999-cb900c5f3802 | 7 | public void remove(String name) throws Exception {
try {
//Construct the new file that will later be renamed to the original filename.
File tempFile = new File(file.getAbsolutePath() + ".tmp2");
BufferedReader br = new BufferedReader(new FileReader(file));
PrintWr... |
e3eca24d-0e41-40d3-a97f-74dd29063b9c | 0 | public void putBomb(Bomb b) {
this.bomb = b;
} |
80f909e3-a41f-4d10-a410-6553ffa946af | 9 | public void method389(boolean flag1, int i, int j, String s, int k) {
aBoolean1499 = false;
int l = i;
if(s == null)
return;
k -= anInt1497;
for(int i1 = 0; i1 < s.length(); i1++)
if(s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@') {
int j1 = getColorByName(s.substring(i1 + 1, ... |
5c20eea5-d7e0-4f01-a2eb-c9144180fbf1 | 7 | public boolean canJump(int[] steps) {
if (steps == null || steps.length == 0) {
return false;
}
if (steps.length == 1) {
return true;
}
int maxReach = 0;
for (int i = 0; i < steps.length; i ++) {
if (i > maxReach) {
re... |
522bc0aa-e8a3-463a-b51a-6fe830a80d1f | 6 | private InstitutionalWeightings parseInstitutionalWeightings(
BufferedReader reader, String line) throws IOException {
int twoInARow = 0;
int twoInADay = 0;
int periodSpread = 0;
int nonMixedDurations = 0;
int frontLoad_1 = 0;
int frontLoad_2 = 0;
int frontLoad_3 = 0;
while ((line = noReadIfAlreadyRe... |
e2e549e1-d0c6-44f9-a97d-1a2d84366190 | 8 | public static void main(String[] args) {
long time=System.nanoTime();
System.out.println("parameter\t\tms\t\tmsms");
int totalFailCount =0;
int currentFailCount =0;
int total =0;
String warnings="";
for (int i =0; i < ARGS.length; i++) {
String[] msmsArgs =ARGS[i];
double[] correctResults =TEST_VALU... |
dcb77b2e-a873-4e25-bada-17239be54602 | 4 | private boolean checkPng() throws IOException {
final byte[] PNG_MAGIC = {0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
byte[] a = new byte[27];
if (read(a) != 27) {
return false;
}
if (!equals(a, 0, PNG_MAGIC, 0, 6)) {
return false;
}
format = FORMAT_PNG;
width = getIntBigEndian(a, 14);
height = getIntB... |
01ee5966-5986-40b9-a091-217327d5c4c9 | 7 | static void saveImages(JmolContainer container, File parentFile) {
if (container.getFillMode() instanceof FillMode.ImageFill) {
String url = ((FillMode.ImageFill) container.getFillMode()).getURL();
String base = FileUtilities.getCodeBase(url);
if (base == null)
url = FileUtilities.getCodeBase(container.g... |
18f9405d-fddb-4a52-9017-bcd906bf0e25 | 7 | private NearbyPlacesResponse findNearbyPlaces(RequestBean request) throws CitysearchException {
NearbyPlacesResponse response = new NearbyPlacesResponse();
List<NearbyPlace> nearbyPlaces = getAdsFromPFP(request, null, getDisplaySize());
List<NearbyPlace> backfill = null;
List<HouseAd> ... |
ce62e67b-3239-4f6f-b9eb-efb80be7c7ae | 8 | public static void main(String[] args) throws java.io.IOException {
if (args.length != 9) {
System.out.println("Usage: HLDAExpt <instances> <num_topics> <path> <num_itns> <print_interval> <save_sample_interval> <optimize> <output_dir>");
System.exit(1);
}
String file = args[0];
int T = In... |
059472d3-4b3d-42e9-b19d-8f46cb19b078 | 9 | public float[] boundingBox()
{
if (entities.size() == 0) return null;
float minX = entities.get(0).position.x, maxX = entities.get(0).position.x;
float minY = entities.get(0).position.y, maxY = entities.get(0).position.y;
float minZ = entities.get(0).position.z, maxZ = entities.get(0).position.z;
if (entitie... |
9b2f16a2-d374-41b2-9012-9d393f82fe39 | 8 | public Enumeration<Area> shipAreaEnumerator(final Area inA)
{
return new Enumeration<Area>()
{
private volatile Area nextArea=null;
private volatile Enumeration<BoardableShip> shipsEnum=ships();
@Override
public boolean hasMoreElements()
{
while(nextArea == null)
{
if((shipsEnum==null... |
5fb03c29-790c-422e-afa9-65ba201804a6 | 8 | private void addLines(){
ListIterator<XInst> i = instructions.listIterator();
int line = -1;
while(i.hasNext()){
XInst inst = i.next();
boolean addLine = inst.line!=line;
if(!addLine){
for(XInst inst2:instructions){
if(inst2.line!=line && inst2.pointingTo(inst)){
addLine = true;
brea... |
182c1429-e68e-40c7-87f1-54302c3ac2cd | 8 | protected void listReplicas(String user, String host) throws DBException
{
PrintStream out = getOutputStream();
Replicas queries = new Replicas(db, getConfiguration());
Cursor<ReplicaInfo> list = null;
try
{
Number defaultId;
{
ReplicaInfo defaultReplica = queries.findReplica(user, host, null);
... |
2d7e129b-0b07-4c3d-86de-9bc53c036a17 | 0 | public static void main(String[] args) {
// 将调用适配器,转换到调用被适配的接口
Target target = new Adapter(new Adaptee());
target.request();
} |
b181fa31-f3f1-4c45-9a3e-cee3404952de | 9 | private void GenNextTestCase(int i)
{
Random r = new Random();
boolean checkTruePath = false;
boolean checkFalsePath = false;
boolean check = false;
for(int j=0; j < this.listCon.get(i).getTruepath().size(); j++)
{
int pos = Math.abs(r.nextInt()%this.listCon.get(i).getTruepath().size());
String res ... |
c159ebb7-1e78-4634-aba5-7bb8f40a91eb | 9 | private void selectLibrarian(){
int choice;
boolean quit;
quit = false;
try
{
// disable auto commit mode
con.setAutoCommit(false);
while (!quit)
{
System.out.print("\n\nPlease choose one of the following: \n");
System.out.print("1. Add ... |
4d0313f0-b7ae-487f-b17f-dbf3244d539f | 7 | public void lancerIMusic() {
int act;
// récupère les évènements des actions de l'utilisateur et transmet des ordres au controleur
do {
this.cons.afficherMenu();
act = this.cons.getActionMenu();
switch (act) {
case 1:
Strin... |
003b0eda-2c39-4243-b450-ba96ceb2b273 | 1 | private static void initNearNeighbour(Composite inComposite, int heightHint) {
final Composite toolbar = new Composite(inComposite, SWT.BORDER);
final Composite imageContainer = new Composite(inComposite, SWT.BORDER);
GridData toolbarGridData = new GridData(GridData.FILL_HORIZONTAL);
toolbarGridData.grabExcess... |
06fdae2d-afb7-4f27-9607-1e4187c54331 | 2 | public String getQueryString()
{
try
{
Iterator<String> it = queryData.keySet().iterator();
String output = "";
while ( it.hasNext() )
{
String thisKey = it.next();
output += thisKey+"="+queryData.get(thisKey)+"&";
}
return output.substring(0,output.length()-1);
} catch (Exception e) {
... |
e74e5a21-bf1f-434b-9ca8-9ace3569ac65 | 8 | private void renderVectors(Atom at, Graphics2D g) {
if (at.getID() != Element.ID_MO && at.isVisible()) {
if (velocityVector)
at.drawVelocityVector(g);
if (momentumVector)
at.drawMomentumVector(g);
if (accelerationVector)
at.drawAccelerationVector(g);
if (forceVector)
at.drawForceVector(g);... |
c0b7cecb-244a-445c-9e42-4ca2e70122fb | 9 | @Override
public void mousePressed(MouseEvent e)
{
if(e.getClickCount() >= 2)
{
byte setting = Byte.parseByte(Configuration.getSetting("action"));
try { Thread.sleep(500); } catch(InterruptedException ex) { }
switch(setting)
{
case 0:
{
AreaSelection.enable();
break;
}
case 1... |
8e4b7220-1286-49b7-8fdf-360b619792ff | 5 | @POST
@Path("PauseLocal")
@Produces(MediaType.APPLICATION_JSON)
public Response PauseLocal(
@FormParam("nb_tour") int nb_tour,
@FormParam("id_partie") int id_partie,
@FormParam("tour") String tour,
@FormParam("login1") String login1,
@FormParam("login2") String login2,
@FormParam("cartesJ1") String ... |
f210d569-ecbb-4393-998c-3c3bbe3d3914 | 3 | public int getAndIncrement (K key, int defaultValue, int increment) {
int hashCode = key.hashCode();
int index = hashCode & mask;
if (!key.equals(keyTable[index])) {
index = hash2(hashCode);
if (!key.equals(keyTable[index])) {
index = hash3(hashCode);
if (!key.equals(keyTable[index])) return getAndI... |
0a901a15-525e-4efa-9bf6-4d03c72d64cb | 4 | public String printFunction() {
Method[] tab = this.getClass().getDeclaredMethods() ;
String separateur = " | ";
String res = "--------------------------------------\n";
res += "------Liste des fonctionnalitées------\n";
res += "--------------------------------------\n";
for (int i = 0; i < tab.length... |
e6cfabb0-ca99-4a58-add9-3cc4ff07ab2b | 3 | private static ArrayList<TreeContainerRow> getTreeContainerRows(Collection<TreeRow> rows, boolean includeChildren) {
ArrayList<TreeContainerRow> result = new ArrayList<>();
for (TreeRow row : rows) {
if (row instanceof TreeContainerRow) {
TreeContainerRow container = (TreeContainerRow) row;
result.add(co... |
5d4322fd-d30f-43cd-a8d7-fd5b2a45d737 | 0 | public int GetTotalPassangersTransported()
{
//copy the amount transported
int tmp=totalPassengersTransported;
//holds the running total
accumulatedPassangers += totalPassengersTransported;
//reset total passangers transported
totalPassengersTransported = 0;
... |
136ae1d4-0035-4dca-b287-3885ae91bbaf | 7 | @Cacheable(value = "sample_cache",key = "#id")
public String getID(String id) {
System.out.println("In Function...");
if (id.equals("1")) {
return("Attila");
} else if (id.equals("2")) {
return ("Bela");
} else if (id.equals("3")) {
return ("Cecil"... |
4f3993f0-1f4e-4f55-a15b-b0809673a9d3 | 2 | public void buildEmptyTrackForTest()
{
if (!built)
{
// Create
Record r = new Record();
r.setAuthor("fake-author");
r.setCategory(new Category("fake-cat", 12));
r.setCatNo("fake-cat-no");
r.setDate(new Date());
r.setDiscogsNum(12);
r... |
e9b77732-c6e2-4161-81ec-e963c7a08d47 | 7 | @Override
public void spring(MOB target)
{
sprung=true;
benefactor.setLocation(target.location());
benefactor.basePhyStats().setLevel(target.phyStats().level());
benefactor.recoverCharStats();
benefactor.recoverPhyStats();
switch(trapType())
{
case TRAP_GAS:
gas(target);
break;
case TRAP_NEEDL... |
27e015c5-09cd-4d74-b5d0-7bb03fe171e9 | 1 | public E first() {
if (size() == 0) {
throw new RuntimeException("First element not available for an empty CycList");
}
return this.get(0);
} |
d91a7002-5cba-4686-95e7-ded400e80b57 | 1 | public static CSTable synthESPInput(CSTable table, Date iniStart, Date iniEnd, int fcDays, int year) {
int dateColumn = 1;
DateFormat hfmt = lookupDateFormat(table, dateColumn);
// Forecast start = end of initialzation + 1 day
Calendar fcStartCal = new GregorianCalendar();
fcS... |
7b198b28-7166-474d-8529-a98293ebf3f6 | 1 | public InverseChiSquared(int nu) throws ParameterException {
if (nu < 1) {
throw new ParameterException("InverseChiSquared parameter nu >= 1.");
} else {
this.nu = nu;
chiSq = new ChiSquared(nu);
}
} |
aa379b5f-78ae-4c37-8f76-10df3c35f946 | 8 | private static HashMap<String, Double> parsePokerStove() throws IOException {
HashMap<String, Double> results = new HashMap<String, Double>();
BufferedReader br = new BufferedReader(new FileReader("pokerstove.txt"));
String line = br.readLine();
ArrayList<String> input = new ArrayList<String>();
whil... |
a35897b8-18b2-4280-a714-d6d760d144b1 | 0 | public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
} |
af207299-0219-4c5d-a3b0-1524f65d962e | 0 | public DistancesInterface getDistance() {
return this.distance;
} |
5444c818-b87b-49bb-a8d7-c5fc5348ddc5 | 5 | public static boolean isImplementingInterface(final Class<?> clz, final Class<?> clzInterface) {
for (Class<?> interf : clz.getInterfaces()) {
if (interf == clzInterface) {
return true;
}
}
return false;
} |
aafcabe8-65f6-4bce-97e1-fb3a11d2b2bb | 6 | static final void method1010(int i, int j, int k, int l, int i1, int j1, int k1, int l1,
int j2) {
Class142_Sub20 class142_sub20 = null;
Class142_Sub20 class142_sub20_1 = (Class142_Sub20) Class39_Sub4.aNodeList_2959.getTail();
for (; class142_sub20_1 != null; class142_sub20_1 = (Clas... |
598f0e27-f837-46eb-977e-a94ddd404e31 | 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... |
8264b5a3-2fd8-48b0-aa19-8c35e97da3a7 | 6 | @EventHandler
public void EnderDragonResistance(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.getEnderDragonConfig().getDouble("E... |
b434e98c-11c6-4659-930d-4198c087c8c6 | 7 | private boolean canCastleKingSide( int position ) {
return ( !hasPieceMoved( pieceAt( position ) ) && !kingInCheck() && pieceTypeAt( position + 3 ) == ROOK && !hasPieceMoved( pieceAt( position + 3 ) )
&& squareEmpty( position + 1 ) && !squareAttacked( position + 1 )
&& squareEmpty( positio... |
53e5ec7b-59bd-4b93-86cb-da6f4dc104a4 | 1 | public boolean addLabel(String label)
throws LabelAlreadyExistsError {
if(labelIndexes.containsKey(label))
throw new LabelAlreadyExistsError(label);
int thisIndex = resolvablesList.size();
PositionedResolvable pr = new PositionedResolvable(label, wordPosition);
resol... |
f335ec90-0018-4193-a0f2-b974111e54bc | 3 | public void setPlayerPieces(Element element){
NodeList tempNodeList;
boolean isPlayerOne = false;
if(element.getAttribute("id").equals("1")){
tempNodeList = m_p1Piece;
isPlayerOne = true;
}else{
tempNodeList = m_p2Piece;
}
for(int i = 0; i < tempNodeList.getLength(); i++){
Node nNode2 = tempNode... |
3105c5f0-696c-4e1d-88de-a8a096bb76ce | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
127d1aa2-3cc8-45ad-9711-d6812da09dab | 6 | @Override
public double evaluate( String query,
HashMap < Integer , Double > query_relevance, // r
ArrayList<ScoredDocument > query_rank){ // my ranking
// Make sure this is iterating over the correct list
Iterator<ScoredDocument> it = query_rank.iterator();
double recall = 0... |
c8e60fa3-76ec-4ba2-b3bf-bed0c8e57b09 | 3 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar();
if (g == null)
return;
if (!Operations.isLL1(g)) {
if (JOptionPane.showConfirmDialog(frame,
"The grammar is not LL(1).\nContinue anyway?",
"Grammar not LL(1)", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION)
... |
cbfac4c0-57b0-4727-ac3f-61f667df5299 | 6 | private void readClasses(
final MultiProcessor executor,
final Map<String, ByteClass> byteClasses,
final List<Pair<ZipEntry, byte[]>> fileEntries
) throws
ZipException,
... |
b2db4b60-2c72-4653-8e8e-b19fff077936 | 3 | Vector<Integer> getNeighboringCellIds(int index) {
if (index >= 0) {
int cellId = cellIds.get(index);
if ((cellId < 0) || (cellId >= mesh.countCells())) {
return new Vector<Integer>(0);
}
return mesh.getNeighbors(cellId);
} else {
... |
5627f30d-fa15-4e67-ab99-26678d2beb32 | 2 | private int nextFreePositon(){
for(int i = 0; i < this.upgrades.length; i++){
if(this.upgrades[i] == null){
return i;
}
}
return -1;
} |
c06017d1-c3e7-4c7a-825a-623bfcb2a529 | 2 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.cities");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
resaveParamsShowCity(request);
formCityList(request);
... |
db61b9aa-0b79-4853-a754-ee80b7edd3e7 | 4 | public void update(double dt) {
super.update(dt);
// zrobione zupelnie na pałę, tak nie powinno być robione
// ale za duzo kombinowania zeby to dobrze wygladalo
// TODO
if (getZScale() < 0.05 && getXScale() < 0.05) {
Application.getGame().getLevel().setProperPositions();
setXScaleSpeed(0.5);
setZS... |
2c1672a0-664c-4ed0-a99f-fdaf7dfb40dc | 6 | @Override
public void deserialize(Buffer buf) {
major = buf.readByte();
if (major < 0)
throw new RuntimeException("Forbidden value on major = " + major + ", it doesn't respect the following condition : major < 0");
minor = buf.readByte();
if (minor < 0)
throw ... |
e8b768a4-22ba-4e4e-9d98-881451a10d93 | 5 | public static int numDistinct2(String S, String T) {
int m = T.length();
int n = S.length();
int[][] path = new int[m + 1][n + 1];
for (int i = 0; i <= m; i++)
path[i][0] = 0;
for (int i = 0; i <= n; i++)
path[0][i] = 0;
for (int i = 1; i <= m; i... |
c5b0c564-bb1d-4f0e-bc44-202072dc061e | 5 | public void decode(Buffer stream) {
pitchEnvelope = new Envelope();
pitchEnvelope.decode(stream);
volumeEnvelope = new Envelope();
volumeEnvelope.decode(stream);
int option = stream.getUnsignedByte();
if (option != 0) {
stream.position--;
pitchModulationEnvelope = new Envelope();
pitchModulationEnv... |
9b117826-a460-4a25-933b-153e06bf9b61 | 0 | public void setC(double a, double b)
{
cA = a;
cB = b;
repaint();
} |
a5bba48d-484b-4781-86c2-06c2986d97dc | 4 | private static void runAnalysisTimeout(final String fileName, final String androidJar) {
FutureTask<InfoflowResults> task = new FutureTask<InfoflowResults>(new Callable<InfoflowResults>() {
@Override
public InfoflowResults call() throws Exception {
final BufferedWriter wr = new BufferedWriter(new File... |
063289b4-f8ef-40db-ae0a-0988055e11b3 | 5 | @Override
public double getYRotation()
{
double lowest = 9001;
double highest = 0;
int y = 0;
if (getRotationAngle() == 90)
y = 20;
if (getRotationAngle() == 270)
y = -20;
for (Block block : blockArray)
{
if (block.getYValue() > highest)
highest = block.getYValue();
if (block.getYValue()... |
ac06c8ad-1669-4f24-b3d9-7f65c6949a3f | 8 | public static Improvement queue(City c, String queue)
{
if (queue == null || c == null) return null;
if (c.takeover <= 0 || c.raze)
{
c.queue = queue;
Improvement i = c.owner.unitImprovements.get(queue);
if (i == null)
{
Improvement building = cityImprovementMap.get(queue);
if (building != nu... |
22fdc4d1-21df-4936-8098-375958cf2ba9 | 6 | public static void merge2(int[] array, int p, int q, int r) {
int n1 = q - p + 1;
int n2 = r - q;
int[] al = new int[n1];
int[] ar = new int[n2];
for (int i = 0; i < n1; i++) {
al[i] = array[p + i];
}
for (int j = 0; j < n2; j++) {
ar[j] = array[q + j + 1];
}
int m = 0, n = 0;
for (int k = p... |
6c03b3ca-0dc9-4008-939c-3026c16a2955 | 3 | public boolean areNondeterministic(Transition t1, Transition t2)
{
MealyTransition transition1 = (MealyTransition) t1;
MealyTransition transition2 = (MealyTransition) t2;
if(transition1.getLabel().equals(transition2.getLabel()))
return true;
else if(transition1.getLabel... |
85a59fc7-79ba-4a8d-8876-ffc9fbb77901 | 5 | public void read(InputStream in) throws IOException
{
try
{
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader parser = factory.createXMLStreamReader(in);
checkNextTag(parser, XMLStreamReader.START_ELEMENT, "matrix");
m = Integer.parseInt(parser.getAttributeValu... |
187eed60-be94-48fc-87b7-ab76e8ae3381 | 8 | public void dragged(int mode, int color, int size, int sx, int sy, int ex, int ey){
// System.out.println("Dragged: " + sx +"," + sy + " :: " + ex + "," + ey);
switch(mode){
case DO_NOTHING_MODE:
// nothing
break;
case DRAW_PIXEL_MODE:
// nothing
... |
f1e66760-d3e8-44a5-800a-acd4ccc964b3 | 0 | public int getUbicacion() {
return ubicacion;
} |
8242f76c-490c-424f-b71c-43713225aa52 | 0 | public double get() {
return _value;
} |
74545f07-76ee-4114-93b2-d29d76a5b8bb | 8 | static final void method1810(int i, int i_0_, int i_1_, int i_2_, int i_3_,
int i_4_, int i_5_) {
if (i_5_ != 8 && (i_5_ ^ 0xffffffff) != -17) {
Class357 class357
= Message.aClass357ArrayArrayArray2029[i_4_][i][i_2_];
if (class357 == null)
class357 = new Class357(i_4_);
if ((i_5_ ^ 0xffffffff) ... |
3f09185a-bcda-4d59-afb5-e4786c927263 | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
b8aa3bda-287c-48fe-9d02-67c1870e46c1 | 5 | public boolean addItem(Item item) {
if (item.isMatch() || item.amount <= 0) {
if (item.isMatch()) I.complain(
"ADDING ILLEGAL ITEM: "+item+" amount/quality:"+
item.amount+"/"+item.quality
) ;
new Exception().printStackTrace() ;
return false ;
}
//
// Check to see... |
81f2f004-419a-42de-a40d-34a531814fd3 | 7 | private boolean setParamsForSubsymbolic(int currentStep) {
//get the next word for text input if asked or no input from last sent
if (readNextWordOn(currentStep)) {currentWord = getNextWord();}
else if (currentSentence == -1) {
currentWord = getNextWord();
if (currentSentence >= 0)... |
42df691b-b5ff-4a49-9676-bb30809dd1e7 | 1 | public final void push(int what) {
if (count>=data.length) incCap(count+1);
data[count++]=what;
}; |
7b258b75-c9d8-4a56-ba99-774977dda504 | 8 | public void actionPerformed(ActionEvent evt){
Object source = evt.getSource() ;
if(source == vue.getItemOuvrir()){
System.out.println("Ouvrir") ;
}
else if(source == vue.getItemEnregistrer()){
System.out.println("Enregistrer") ;
}
else if(source == vue.getItemQuitter()){
System.out.println("Quitter... |
23b298d5-536c-44d8-8c81-4772a206e5ed | 2 | @SuppressWarnings("unchecked")
public V getOrCreate(K key) {
V v = get(key);
if (v == null) {
try {
v = (V) instance.getClass().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
put(key, v);
}
return v;
} |
223961da-d911-488a-bd8c-8c45d3819cf2 | 1 | private void internalTracking(boolean b) {
if (b) {
class TrackingSlip {
private String id;
TrackingSlip(String s) {
id = s;
}
String getSlip() {
return id;
}
}
TrackingSlip ts = new TrackingSlip("slip");
String s = ts.getSlip();
}
// Can't use it here! Out of scope:
... |
e7ee0f21-da29-456e-b1dd-7a03fe55936c | 7 | private void tulostaKentta() {
rajaaja.etsiKoordinaatit(getMuistio().getMerkit());
for (int i = rajaaja.getSuurinY(); i >= rajaaja.getPieninY(); i--) {
for (int j = rajaaja.getPieninX(); j <= rajaaja.getSuurinX(); j++) {
boolean loytyiko = false;
for (Merkki m... |
327bef14-0781-4751-9bc6-ed309cb89fb4 | 0 | public String getSearch_word() {
return search_word;
} |
4f462519-32c6-41fb-a2b7-689d4755ef1b | 9 | static List<Map<String, Set<String>>> find_connected_subgraphs(Map<String, Set<String>> graph,
Set<String> root_ids,
Set<String> leaf_node_ids) {
List<Set<String>> subgraph_id_se... |
3d03175e-a996-43d8-a919-a0a19488dc08 | 5 | @Override
public Usuario excluirProdutoListaDeDesejos(String idProduto,
Usuario usuario) {
EntityManagerFactory factory = Persistence
.createEntityManagerFactory("classeEncanto");
EntityManager em = beginTransaction(factory);
try {
Set<UsuarioProduto> listaDeDesejos = usuario.getListaDeDesejos();
... |
581c959d-79eb-450d-9bf5-421cc61cc3d5 | 0 | public void setId(int id) {
this.id = id;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.