method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fad0a616-3acc-492a-86db-e5015c920586 | 9 | private static Def convert(XmlConfig cfg, com.grey.naf.Config nafcfg, Def def, String peername, boolean client)
throws com.grey.base.ConfigException, java.io.IOException
{
if (def == null) def = new Def();
int pos = peername == null ? -1 : peername.indexOf(':');
if (pos != -1) peername = peername.substring(0,... |
07b662bb-668f-4493-ab65-470a47e9d1a8 | 3 | private Integer parseInt() throws StreamCorruptedException {
StringBuffer lenStr = new StringBuffer();
while (input.remaining() > 0) {
char ch = input.get();
if (ch == ';') {
//indexPlus(1);
break;
} else {
lenStr.append(ch);
}
}
Integer value = 0;
try {
value = Integer.valueOf(len... |
61e835d8-57da-4f2b-b13e-a8da0f2eb2cf | 5 | public void main() {
Stage stage=new Stage();
ToolBar toolBar=new ToolBar();
Button btn1=new Button("Danes");
btn1.setFocusTraversable(false);
Button btn2=new Button("Jutri");
btn2.setFocusTraversable(false);
Button btn3=new Button("Pojutrišnjem");
btn3.... |
9195f606-6832-4f85-b509-85d2b0365095 | 2 | private void create(int initialValue, Color bg, String fieldTitle, String fieldlabel, boolean showResetBtn) {
setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT));
setBackground(bg);
setBorder(BorderFactory.createTitledBorder(fieldTitle));
setLayout(new Vertical... |
b098cb22-18e2-4706-beff-cfcace043dd9 | 1 | public static void main(String[] argv) {
if (argv.length < 2) {
System.out
.println("Incorrect parameters.\nUsage: java -cp bin:libs/snakeyaml-1.13.jar lab0.Logger <config_filename> <local_name>");
} else {
Logger logger = new Logger(argv[0], argv[1]);
logger.listen();
logger.showCommandPrompt();
... |
0beefaf1-3119-476b-9c14-7b4e965c5881 | 4 | public static void init() {
try {
DIR.mkdirs();
new File(DIR, "saves").mkdir();
File us = new File(DIR, "username");
if (!us.exists() || us.length() == 0) {
USERNAME = JOptionPane.showInputDialog("Bitte gib deinen Benutzernamen an.");
if (USERNAME == null) System.exit(0);
us.crea... |
44bdcd9c-d2f3-40f4-8aa5-7a0a3b796744 | 5 | @Override
public void createFromXML(NodeList attributes) {
for(int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Node value = node.getFirstChild();
if(node.getNodeName().equalsIg... |
6413be5c-07e0-4f43-99bf-e2f28aff616b | 9 | public int[] getCurrentSituation() {
int[] situation = new int[5];
// observe cell to the north
if (current.isAgainstNorthWall()) {
situation[0] = Site.WALL;
}
else {
if (grid[curY - 1][curX].hasCan()) {
situation[0] = Site.CAN;
}
else {
situation[0] = Site.EMPTY;
}
}
// obser... |
cda31f88-551a-4c3a-ad3a-ddea38c0f8b9 | 6 | private void draw()
{
//De achtergrond tekenen
g.drawImage(bgimage, 0, 0, 0);
//De pijl die positie aangeeft tekenen
g.drawImage(positie, 105, count * 87, 0);
//Als piano open staat tekenen we de pads voor de piano
if(piano.active)
{
for(int i = 0; i < 5; i++)
{
instruments[i].draw();
}
}... |
e1d28d35-b1cf-4cb6-b7d7-3ec859c1aa8a | 2 | public static JnlpBrowser create() {
try {
Class<? extends ServiceManager> cl = Class.forName("javax.jnlp.ServiceManager").asSubclass(ServiceManager.class);
Method m = cl.getMethod("lookup", String.class);
BasicService basic = (BasicService)m.invoke(null, "javax.jnlp.BasicService");
return(new Jnlp... |
5354b8df-e134-490e-a6ba-beb9d3630296 | 6 | boolean userWon() {
for (int i = 0; i < 3; i++)
if (getNumEachPiece(board[i], X)[0] == 3)
return true;
for (int j = 0; j < 3; j++)
if (getNumEachPiece(getColumn(j), X)[0] == 3)
return true;
if (getNumEachPiece(getBottomUpDiag(), X)[0] == 3
|| getNumEachPiece(getTopDownDiag(), X)[0] == 3)
retu... |
e04e3a3f-ca70-4745-84b1-22df84a7df8a | 1 | public void award_bonus(BigInteger threshold, BigInteger bonus) {
if (getBalance().compareTo(threshold) >= 0)
deposit(bonus);
} |
22797733-acc6-4737-98e3-2a0a42340098 | 7 | public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof ConnectionDetails)) {
return false;
}
final ConnectionDetails otherConnectionDetails = (ConnectionDetails)other;
return
hashCode() == otherConnectionDetails.hashCode() &&
getLocalPort() == otherCo... |
a77e9f06-59c4-4612-a936-d4d080f99c23 | 9 | * @param theta the angle with which to calculate R
* @return the radius
*/
private double calculateR(int type, double theta) {
double r = 0;
switch(type){
case 1 :
r = scaleFactor * (Math.cos(3*theta));
break;
case 2 :
r = scaleFactor * (a * theta);
break;
case 3 :
r = scaleFactor... |
a2804b69-c735-48c0-8f54-52f3e1b48353 | 5 | private boolean backupApps() {
new Thread() {
@Override
public void run() {
ProcessBuilder process = null;
Process pr = null;
List<String> args = null;
String line = null;
BufferedReader reader = null;
... |
1918ca91-6cd7-4c5e-a08e-9b741e821d97 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
4e2ca121-d09d-4baa-8795-4f6e4597bba2 | 5 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
for (int i = target.length - 1; i >= 0; i--) {
target[i].visit(visitor);
}
for (int i = source.length - 1; i >= 0; i--) {
source[i].visit(visitor);
}
} else {
for (int i = 0; i < source.length; i++) {
so... |
32fdc0a5-3375-40c3-8a8f-b321d65efa63 | 1 | @Override
public Map<String, Collection<?>> call() throws Exception {
return null;
} |
671f2eb9-7cea-4ef0-9f9a-18895abff6e8 | 6 | public static Consensus reAlign(Alignment layoutMap, double epsilonPrecision, int numOfIterations) {
Consensus consensus = getConsensus(layoutMap);
double initialScore = consensus.getConsensusScore();
boolean shouldContinue = true;
int iteration = 1;
int length = layoutMap.keySet().size();
ArrayList<Integer... |
81cfbd5e-680d-489d-801f-d33f78cb02f9 | 9 | public void InitUI()
{
// Initializing button images
try {
Image img = ImageIO.read(getClass().getResource("/karel/guipics/stop.png"));
Stop.setIcon(new ImageIcon(img));
} catch (IOException ex) {}
try {
Image img = ImageIO.read(getClass().... |
7c6ee35f-8730-415d-81e1-d93fb059fc91 | 0 | @Override
public IReceiveQuery getReceiveQuery() {
return receiveQuery;
} |
3d62aa97-cf74-47a8-9140-b78ba28f8256 | 5 | public Object getValueAt(int row, int col) {
if (col == 0) {
return data.getBusinessObjects().get(row).getNr();
} else if (col == 1) {
return data.getBusinessObjects().get(row).getMensuality();
} else if (col == 2) {
return data.getBusinessObjects().get(row).getIntrest();
} else if (col == 3) {
retu... |
38f643b4-2a06-4272-9271-560863523695 | 9 | public static List<ExInterval> unionExIntervals(List<ExInterval> I) {
// Empty input.
List<ExInterval> uni = new ArrayList<>();
if (I.isEmpty()) {
return uni;
}
// Sorts ExIntervals according to their left endpoints.
Collections.sort(I);
ExInterval c... |
1c53013e-1c52-4951-9266-29d9a73fae3f | 3 | public void solve() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (n < 9) {
System.out.println(0);
System.exit(0);
}
if (n == 9) {
System.out.println(8);
System.exit(0);
}
System.out.print("72");
StringBuilder sb = new StringBuilder();
for (i... |
ca9cfc72-43d8-4e0e-8bd5-db70c09d0a89 | 5 | public String blockTypeToString(){
String s = "unrecognized";
switch( getBlockType() ){
case BLOCK_TYPE_UNKNOWN: s = "unknown"; break;
case BLOCK_TYPE_CATALOG: s = "DB catalog"; break;
case BLOCK_TYPE_BPT_HEADER: s = "B+Tree header"; break;
case BLOCK_TYPE_BPT_INTERNAL: s = "B+Tree internal"; br... |
719df004-fda9-470e-a9ec-144f6cb8ef79 | 2 | private void shuffleParticles(double[][]particles) {
for(int i = 0; i < numberOfParticles; i++){
for(int k = 0; k < particles[i].length; k++){
int index = i + (int)(Math.random() * ((particles.length - i) + 1));
double temp = particles[i][k];
particles[i][k] = particles[i][index];
particles[i][inde... |
9bab5e98-0d86-44ae-94b4-a64dfa832d43 | 7 | public AST rFactor() throws SyntaxError {
AST t;
if (isNextTok(Tokens.LeftParen)) { // -> (e)
scan();
t = rExpr();
expect(Tokens.RightParen);
return t;
}
if (isNextTok(Tokens.INTeger)) { // -> <int>
t = new IntTree(currentToke... |
9f4b3448-f9b0-4ddb-8aba-9a992dd535ab | 7 | public static void frequencyCount(String s) {
char c[] = s.toCharArray();
int count;
for (int i = 0; i < c.length; i++) {
count = 0;
for (int j = 0; j < c.length; j++) {
if ((j < i) && (c[j] == c[i])) {
break;
}
else if ((j >= i) && (c[i] == c[j])) {
count++;
}
}
if (count !=... |
cf5c00ef-11e5-48a3-a2c1-26a5cc826ce7 | 4 | public static void main(String[] args){
Chap15Q6<String> rs = new Chap15Q6();
for(String s : "go to the hell".split(" ")){
rs.add(s);
}
for(int i = 0; i < 10; i++)
print(rs.select());
Chap15Q6<Integer> intrs = new Chap15Q6();
int[] nums = {1,2,3,4,5,6};
for(Integer i : nums){
intrs.add(i);
}... |
4ee93a15-4db3-4eef-91c0-9a5f1a6bdabc | 4 | public synchronized void replaceContactInBucket(Bucket bucket, Contact node)
{
if (node.isAlive())
{
Contact leastRecentlySeen = bucket.getLeastRecentlySeenBucketContact();
//The LRS node can be replaced if it is not the local node, AND it is DEAD
if ... |
42894dc7-3c4f-4afb-90c0-0bd1174fb1e4 | 2 | private void createStructure() {
Random random = new Random((int)Math.random()*100);
data = new DataArrays<Float[]>();
for(int i=0; i<kitSize; i++){
array = new Float[length];
for (int j=0; j<array.length; j++){
array[j] = random.nextFloat()*chars;
... |
7e1f95e2-a4fd-41b1-bfef-7e503a831006 | 3 | public boolean load(String mainClass, String mainMethod, String version, BufferedImage icon)
{
try
{
_loader = new URLClassLoader(new URL[]{_path.toURI().toURL()}, Launcher.class.getClassLoader());
Class<?> cl = _loader.loadClass(mainClass);
cl.getMethod(mainMethod, new Class<?>[]{BufferedImage.class, Str... |
5cd18bff-ee79-43fb-b219-0fabc08c0bcb | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
6e653909-af3d-448a-9768-81a5d78025f5 | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("eweather")) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("update")) {
return updateWeather(sender);
... |
dbef9208-1de5-4bb0-8a20-ac1a1d6dbee0 | 9 | public static Locale parseLocale(String localeString) {
StringTokenizer localeParser = new StringTokenizer(localeString, "-_");
String lang = null, country = null, variant = null;
if (localeParser.hasMoreTokens())
lang = localeParser.nextToken();
if (localeParser.hasMoreTok... |
6c74a58e-50bb-48e1-b031-3e6b94d93df8 | 7 | public boolean isPrime(long l) {
// extend our list of primes if necessary in order to search for l
while (maxPrimeFound < l) {
this.getNext();
}
// now binary search for l
int lo = 1;
int hi = numPrimesFound;
while (true) {
int mid = (lo+hi) / 2;
long midPrime = primesFound.get(mid);
if (m... |
729c2ce8-a36b-4893-a509-8a15af64801d | 6 | public void save() {
if (datacfg != null) {
for (String key : datacfg.getKeys(false)) {
datacfg.set(key, null);
}
}
for (SellSign sign : mh.getSellSigns()) {
Block b = sign.getBlock();
String key = "SellSigns." + b.getWorld().getName() + "." + sign.getRegion().getId();
datacfg.set(key + ".Type"... |
cfa9e27a-0cd0-4134-9ef8-cac7c0d05036 | 2 | public static ItemStack convertToCraftItemStack(ItemStack itemStack) {
if (AS_CRAFT_OPY_ACCESSOR == null) {
ClassTemplate template = new Reflection().reflect(MinecraftReflection.getCraftItemStackClass());
List<SafeMethod<ItemStack>> methods = template.getSafeMethods(withExactName("asCra... |
e662a4a1-5ff1-46f9-abef-6b01f16aff28 | 4 | public static void main(String[] args) {
Socket socket = null;
try {
socket = new Socket(host,port);
// 请求连接为低成本连接
socket.setTrafficClass(0x02);
// 请求高性能与最小延时
socket.setTrafficClass(0x04|0x10);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTra... |
15b34519-6f80-4bb1-a98b-7b810237beb0 | 6 | private void treeRefresh(File[] masterFiles) {
TreeItem[] items = tree.getItems();
int masterIndex = 0;
int itemIndex = 0;
for (int i = 0; i < items.length; ++i) {
final TreeItem item = items[i];
final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
if ((itemFile == null) || (masterIndex == mas... |
9be574bd-e285-426f-af25-c2a07e4b6ecc | 1 | @Override
public void enter() {
Group root = GroupBuilder.create().build();
String[] menuButtonLabels = { "Singleplayer", "Multiplayer", "Credits", "Quit" };
final StateType[] menuButtonEvents = { StateType.SINGLE_PLAYER_SELECTED, StateType.TWO_PLAYER_SELECTED, StateType.CREDITS_SELECTED,
StateType.QUIT_SE... |
7b6b29bf-758e-4435-8426-cb35d9e57fbc | 8 | public static boolean isTable(String OID) {
switch(OID) {
case "1.3.6.1.2.1.1.9":
return true;
case "1.3.6.1.2.1.2.2":
return true;
case "1.3.6.1.2.1.3.1":
return true;
case "1.3.6.1.2.1.4.20":
return... |
3841a828-42f9-4716-8a69-2e6d49bb0776 | 2 | public Bid_DTO getBid(long bidId) throws NoHayDatosDBException {
Bid_DTO bidResultado;
bidResultado = null;
String CONSULTA = "SELECT * FROM actionBazaar.Bid WHERE idBid = ?";
try{
PreparedStatement pstmt = conexion.prepareStatement( CONSULTA );
pstmt.setLong( 1 ... |
87915ec0-bb2a-4487-8de3-282002cbfcbd | 3 | private void comboCidadeAssessoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCidadeAssessoriaActionPerformed
String item = String.valueOf(comboModelCidadeAssesoria.getSelectedItem());
if(item.equals("Selecionar....") || item == "null"){
System.out.println("O... |
aecfd819-70da-4a98-b150-0b80a6c0f20f | 4 | public static int getLongestShipNotDestroyed()
{
ArrayList<Integer> shipSizesLeft = new ArrayList<Integer>();
for(int size : BattleShipGame.shipSizes)
shipSizesLeft.add(new Integer(size));
for(Ship ship : sunkShips)
shipSizesLeft.remove(new Integer(ship.getSize()));
int largest = 1;
for(Intege... |
277ef8fd-b777-4e65-80bd-c59eedb874e4 | 0 | @Before
public void setUp() throws Exception
{
} |
5af1803d-a489-49db-af68-4b5dec6b2626 | 9 | public void onAction(String name, boolean isPressed, float tpf) {
if (inputEnabled) {
if (name.equals("up") && isPressed) {
up = true;
}
if (name.equals("down") && isPressed) {
down = true;
}
if (name.equals("right") && ... |
fbdd731b-724a-468c-bd4d-6cf203a11cc7 | 0 | public KeyStroke getKey() {
return KeyStroke.getKeyStroke('d');
} |
fcf8263b-562f-4bdc-80f4-02c8ad6b4708 | 2 | public TableCellRenderer getCellRenderer(int row, int column) {
if (!finalEdit)
return super.getCellRenderer(row, column);
int mc = convertColumnIndexToModel(column);
return cellEditors[row][mc] == null ? super
.getCellRenderer(row, column) : RENDERER;
} |
cc55035b-55b8-4ed9-aa4e-a8aef5baf2a1 | 8 | public void remoteSignal(String from,String method,String url) {
if (url.indexOf("/smithers/downcheck")!=-1) {
for(Iterator<SmithersProperties> iter = smithers.values().iterator(); iter.hasNext(); ) {
SmithersProperties sm = (SmithersProperties)iter.next();
if (!sm.isAlive()) {
LOG.info("One or more s... |
c2406472-cff7-499d-b7d5-b4a603d09846 | 0 | public SHSMsgBean() {
} |
5acfe317-5600-4af6-9136-d10accaca109 | 1 | @Override
public String toString() {
StringBuilder sBuilder = new StringBuilder();
sBuilder.append("########################################\n");
sBuilder.append("# BeatTime plugin collection preferences\n");
sBuilder.append("# Only change these settings via this \n");
... |
95c14b46-989e-4ce7-a85f-a1ca703758fa | 5 | private int is(int x, int y) {
if (x < 0 || x > cwidth - 1 || y < 0 || y > cheight - 1) {
return 1;
}
return (cells[y][x] == true ? 1 : 0);
} |
0be7f555-b849-4699-8705-3bb2d7997b5e | 6 | public void load(Thinlet thinlet, Object table) {
UIDefaults defaults = UIManager.getDefaults();
Hashtable iconcache = new Hashtable();
for (Enumeration keys = defaults.keys(); keys.hasMoreElements();) {
String key = (String) keys.nextElement();
Object value = defaults.get(key);
Object row = Thinl... |
e8400ad8-7d8c-4695-a6f8-156ac70e0193 | 4 | public static boolean isInRange( String rng, int rowFirst, int rowLast, int colFirst, int colLast )
{
int[] sh = getRowColFromString( rng );
// the guantlet
if( sh[1] < colFirst )
{
return false;
}
if( sh[1] > colLast )
{
return false;
}
if( sh[0] < rowFirst )
{
return false;
}
if( sh... |
1486d760-9313-4112-a2a3-c54e212a94e0 | 6 | @Override
public void vieraile(TormaysReunaanViesti viesti) {
// toisin kuin pallo jonka paikka palaa keskelle jos törmää ylä\alareunaan, tämä törmääjä voi törmätä
// esimerkiksi aivan vasemman reunan yläosan tuntumassa vasempaan reunaan ja välittömästi törmätä yläreunaan
// jos suunta ei h... |
c72b6a05-c41b-42cc-87ff-fce9967aaedf | 0 | @Basic
@Column(name = "last_name")
public String getLastName() {
return lastName;
} |
cd1224ed-f714-45c2-8674-09c4ef6b1752 | 8 | public void setType(String type)
{
if (type.equals("eau") || type.equals("feu") || type.equals("terre") || type.equals("air"))
{
typeSorcier_ = type;
if (type.equals("air"))
puissanceType = 1;
if (type.equals("eau"))
puissanceType = 2;
if (type.equals("feu"))
puissanceType = 3;
if (type... |
6653bb56-1a10-4611-b43c-5478649a3cb3 | 4 | public String readUrl(String urlString) {
BufferedReader reader = null;
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buffer = new StringBuffer();
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) !... |
776db047-6e0e-4a78-bea6-dd04a1785e26 | 5 | private void readHand(GameState state) {
int cardsInHand = countCardsInHand(state.getScreen());
if(cardsInHand > handCostIndiciesByHandSize.size()) {
throw new GameStateViolationException("Too many cards in hand, the parser is probably reading pixels it shouldn't");
}
List<Integer> cardCostOffsets = handC... |
84e9c98e-8ed4-447f-a439-e4b4c08734fa | 8 | public void heapify(ArrayList<Integer> array, int index,int size) {
int left = this.getLeft(index);
int right = this.getRight(index);
int largest = array.get(index);
int temp = index;
if (left != -1 && array.get(left) > largest && left<size) {
largest = array.get(left);
temp = left;
}
if (... |
f8588f36-8962-4d09-81c3-d903ba04e6e3 | 0 | public static Filter isInterface()
{
return new IsInterface();
} |
2ad6be78-d349-470b-aab4-7b5052cf856c | 1 | public int getAttendance(){
if(attendees != null){
int attendance = attendees.size();
return attendance;
} else{
System.out.println("There are not attendees listed for this meeting!");
}
return 0;
} |
458af874-0d41-49b6-89fb-aa03ad72ccc1 | 0 | public String toString() {
return getDescription();
} |
e7cc44ef-7ee6-435b-be47-9658e5b5439f | 8 | public void itemStateChanged(ItemEvent evt) {
//LookAndFeel laf = UIManager.getLookAndFeel();
JRadioButton source = (JRadioButton) evt.getSource();
if (source == radioLaFGTK)
try {
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel("com.sun.java.swing.plaf.... |
c89f4a4c-8fca-426a-94a8-8604663b9d7c | 7 | protected double[] missingValueStrategyAggregateNodes(double[] instance,
Attribute classAtt) throws Exception {
if (classAtt.isNumeric()) {
throw new Exception("[TreeNode] missing value strategy aggregate nodes, "
+ "but class is numeric!");
}
double[] preds = null;... |
7fad6d30-3053-4322-9e3f-9c48141eb066 | 4 | public static void copyBlob(String srcContainerName, String policyId,
String destContainerName, String blobName, int server) {
CloudBlobClient cloudBlobClients = null;
CloudBlobClient cloudBlobClientd = null;
try {
storageAccountSource = new CloudStorageAccount(
new StorageCredentialsAccountAndKey(
... |
59e9ea4e-c485-45e7-83a3-8421f0239036 | 1 | public void delTriangles( ArrayList<Triangle> triangles ) throws Exception
{
glBindBuffer( GL_ARRAY_BUFFER, resource.getVboIndex() );
for ( Triangle triangle : triangles )
delTriangle( triangle, false );
glBindBuffer( GL_ARRAY_BUFFER, 0 );
} |
6e098051-b845-4f2d-a423-45683bc78993 | 8 | public boolean tntcontrolSubCommand(CommandSender sender, String[] args) {
boolean cmdProcessed = false;
String subCommand = args[1].toLowerCase();
if (subCommand.equalsIgnoreCase("limit")) {
limitOption(sender, args);
cmdProcessed = true;
}
if (subCommand.equalsIgnoreCase("yield")) {
yieldOption(... |
7e5901ea-c35a-4967-894d-6d9a9d1481d2 | 6 | public Map<String, Set<String>> identifyInterface(Set<String> interfaceNames, Set<String> classNames) throws ClassNotFoundException {
this.interfaceFilter = (null == interfaceFilter) ? new HashSet<String>() : interfaceFilter;
this.packageFilter = new HashSet<String>();
this.jarFilter = new HashSet<String>();
Ma... |
54b8f890-d688-4485-8125-02b6cf702723 | 1 | public void setTransient() {
if(level > 20) {
level = 20;
}
} |
0357c344-845d-4669-b28c-8b9e792d547a | 2 | public double deltaT(double JD) {
double T = (JD - J2000) / JCY;
double[][] data = { { -25.0, 184.4, 111.6, 31.0, 0.0 },
{ -17.0, -31527.7, -4773.29, -212.0889, -3.93731 },
{ -10.0, 6833.0, 1996.25, 186.1189, 3.87068 },
{ -3.5, -116.0, -88.45, -22.3509, -3.07831 },
{ -3.0, -4586.4, -4715.24, -1615.... |
97f0f025-9614-4ad2-bc03-a422c4b67aa6 | 4 | public PreparedHTTPResponse create( HTTPHeaders headers,
PostDataWrapper postData,
UUID socketID,
Socket socket,
UUID sessionID,
Map<String,BasicType> additionals
) {
this.getHTTPHandler().getLogger().log( Level.INFO,
getClass().getName(),
"socketID=" + socketID ... |
ff3c48d3-20cd-4fbc-8448-60c13bb59f29 | 5 | public void createTree(int n, int k){
if(Integer.bitCount(k) != 1)
{
System.err.println("number of parts must be a power of 2");
System.exit(-1);
}
// get the maximum number of links that can be stored
boolean failed = true;
double maxLink... |
11907d99-75d6-4683-8f5e-5cce37181fba | 4 | private void loadCounts() {
String anstallda = "";
String kompetenser = "";
String projekts = "";
String plattformar = "";
try {
String query = "select count(*) from anstalld";
anstallda = DB.fetchSingle(query);
} catch (InfException e) {
... |
33077774-898d-42ea-b9ce-2c7cdba10c6d | 3 | private void calcShadowDrop() {
if (pane != null) {
maxFall.setLocation(location);
maxFall.translate(0, 1);
point.setLocation(location);
do {
if (!assertLegal(pane, block, point, block, null)) { break; }
else { point.translate(0, -1); maxFall.translate(0, -1); }
} while (true);
}
} |
9511dd09-578e-4836-b4df-f2b404e7ffd1 | 4 | static String bitSetToString( ArrayList<Version> sigla,
ArrayList<Group> groups, BitSet bs )
{
try
{
StringBuilder sb = new StringBuilder();
for ( int i = bs.nextSetBit(0); i>= 0; i = bs.nextSetBit(i+1))
{
Version v = sigla.get(i-1);
... |
cd76f78b-9300-44bb-a121-0b99d420dc50 | 6 | private void getFloorPlan(String inputFile) {
String line = null;
BufferedReader br = null;
File f = new File(inputFile);
try {
br = new BufferedReader(new FileReader(f));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "File not Found", e);
}
for (;;) {
... |
a477780a-c9ae-45da-be06-970024f9cc09 | 0 | @Override
public String toString() {
return null;
} |
ea1198f6-a189-4d84-a3ae-eaacfb1d32aa | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JsonString other = (JsonString) obj;
if (other.hasComments() ^ hasComments())
return false;
if (value == null) {
if (other.value !=... |
dc3929a2-ed14-4a61-88dd-d27aec7fe46f | 4 | public Matrix times(Matrix B) {
Matrix A = this;
if (A.N != B.M) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(A.M, B.N);
for (int i = 0; i < C.M; i++)
for (int j = 0; j < C.N; j++)
for (int k = 0; k < A.N; k++)
... |
96417752-bd08-4400-bebb-f308fb8f0cec | 3 | @Override
public String getColumnName(int column) {
String name = "?";
switch (column) {
case 0:
name = "Name";
break;
case 1:
name = "Date";
break;
case 2:
name = "Type";
... |
d843e27a-15aa-441b-9973-ac07234e1017 | 2 | @Override
public Serializable load(){
try {
db.start();
DBCollection collection = db.getDB().getCollection("games");
XStream xStream = new XStream();
DBObject obj = collection.findOne();
if (obj == null)
return null;
String xml = (String)obj.get("blob");
Serializable xmlObj = (... |
12a376c1-1eab-4c30-846f-053c60f792a3 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In Maritime Trade handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
String unvalidatedCookie = exchange.getRequestHeaders().get("Cookie").get(0);
... |
9d9e6696-9f3c-4756-a8df-1f52f0c247a6 | 7 | public void execute(HyperGraph graph) throws MaintenanceException
{
HGIndexer indexer = graph.get(hindexer);
if (indexer == null)
return;
HGIndex<?,?> idx = graph.getIndexManager().getIndex(indexer);
if (idx == null)
throw new MaintenanceException(false,"Indexer " + indexer + " with handle " + hindexer... |
03aa8451-baff-4d00-b835-8a783f27a303 | 1 | public void visitEnd() {
if (argumentStack % 2 != 0) {
declaration.append('>');
}
argumentStack /= 2;
endType();
} |
08c98ac1-e33d-46fc-be93-c8a33bec1e62 | 7 | public void cycle() {
// Do instruction limiting so we don't run at light speed
if(!limiter())
return;
// If we've hit the instruction limit, reset count so that
// the timers can be updated
if(instruction_count == 5)
instruction_count = 0;
System.out.println(String.format("\n\nPC@%x: %x; I: %x", PC... |
c027ba91-6114-4eca-b5e5-6959f2ac62a0 | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 140
// [, line 141
ket = cursor;
// substring, line 141
among_var = find_among_b(a_7, 18);
if (among_var == 0)
... |
2056a900-1df8-4360-ad8b-e16d4b9643d5 | 2 | private static void getAvailableFlights()
{
//for each flight
for(Flight flight:flightList)
{
if(flight.hasOpenSeats())
{
//we already know that the flight is not empty
//print out Flight#, Date, and seats remaining
... |
1de1de97-289a-408e-8130-d7102c6d1f7e | 5 | public Model(int playerCount) {
listener = new ArrayList<IModelChangeListener>();
field = new Field(FIELD_WIDTH, FIELD_HEIGHT);
player = new Player[playerCount];
activeItems = new ArrayList<Item>();
newActiveItems = new ArrayList<Item>();
for (int i = 0; i < playerCount; i++) {
player[i] = new Player(1,... |
c3b8d62b-b62e-4c38-ac04-f87eb8919e92 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("This place is already a sanctum."));
return false;
}
if(!super.... |
e1e3167c-544a-4646-963f-6a76bf6544ae | 9 | */
public static long
PointToAngle
( int x,
int y )
{
// MAES: note how we don't use &BITS32 here. That is because we know that the maximum possible
// value of tantoangle is angle
// This way, we are actually working with vectors emanating from our current position... |
4228b60d-c3f3-4963-8c7a-8ecb083102b7 | 7 | public static void startupWalk() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (Stel... |
eb0a5d74-1e96-42b4-b1cd-65c1b1e93c7d | 5 | @Test
public void testInfixToPostfix15() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast("+");
infix.addLast("-23");
QueueInterface<String> postFix = calc.infixToPostfix(infix);
Str... |
724866c2-8f17-4fb7-819b-4bb5738261dd | 7 | public void updatePosition() {
if (xPos < xDestination)
xPos += 1;
else if (xPos > xDestination)
xPos -= 1;
if (yPos < yDestination)
yPos += 1;
else if (yPos > yDestination)
yPos -= 1;
if (xPos == xDestination && yPos == yDestination && currentlyAnimating) {
currentlyAnimating = false;
role.... |
e9306caf-604f-48fa-81e9-7230de415330 | 7 | public void update(float dt) {
// handle key presses
int ttx = (Keyboard.isKeyPressed(Keyboard.Key.A) ? -1 : 0) + (Keyboard.isKeyPressed(Keyboard.Key.D) ? 1 : 0);
int tty = (Keyboard.isKeyPressed(Keyboard.Key.W) ? -1 : 0) + (Keyboard.isKeyPressed(Keyboard.Key.S) ? 1 : 0);
Vector2 targe... |
ac986e53-2aaf-4c6d-bdb1-de2b9d2b15a7 | 3 | @Override
public void mousePressed(MouseEvent e) {
for (Interface i : InterfaceHandler.getActiveInterfaces()) {
if (i.getBounds().contains(e.getX(), e.getY())) {
if (InterfaceHandler.getFocused() != i)
InterfaceHandler.setFocused(i);
break;
... |
b1d16777-34db-4037-810d-8d328a2dcc98 | 1 | public static void main(String[] args) {
/************************************************************************/
/*login information:
trial: set dummy account:
user name: user
password: user
real: load file IO here:
load text file storing user account information
*/
/*******... |
e5a9a77f-f46e-424f-aede-05a7425fca46 | 5 | void toggleLift() {
//System.out.println("Toggle lift");
if (cloud != null) {
//System.out.println("set cloud to null");
cloud = null;
app.cameraMan.cutSetup(flyingDot, flyingDot.isUser);
return;
}
if (circuit != null) {
//Syst... |
65f3d6dd-13ef-4c70-af76-e3528f308c36 | 4 | public void preview(
boolean canPlace, Rendering rendering, Tile from, Tile to
) {
if (from == null) return ;
final Tile t = from ;
final World world = t.world ;
setPosition(t.x, t.y, t.world) ;
final TerrainMesh overlay = world.terrain().createOverlay(
world, surrounds(), false, Texture... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.