method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f60c4d85-e77a-446d-81dc-4fc6773c91e5 | 5 | public static void main(String[] args) throws IOException {
BufferedReader inputStream = null;
inputStream = new BufferedReader(new FileReader("d:/temp/rosalind_gc(1).txt"));
Map<String, String> strDNAs = new HashMap<String, String>(); // набор строк DNA
Map<String, Double> gcDNAs = new HashMap<String, Double>(... |
05c7021c-e7ad-4008-a8b1-cef80f8c1619 | 0 | @Override
public void execute(VirtualMachine vm) {
super.execute(vm);
((DebuggerVirtualMachine) vm).exitFunction();
} |
957f924b-f2a4-4098-baf2-4ae6472e6b4e | 6 | public int compareTo(Object o) {
CollectionAndArtist other = (CollectionAndArtist) o;
if (artist != null && collection != null)
return artist.equalsIgnoreCase(other.artist) && collection.equalsIgnoreCase(other.collection) ? 0 : 1;
else if (artist != null)
return artist.e... |
7a92cccb-d5b7-44c9-9e06-23d4f19b8655 | 1 | public static BufferedImage fixImage(File infile) throws IOException {
BufferedImage img = ImageIO.read(infile);
if(img.getWidth() == 375) { // Default size when exporting from MSE
img = ImageUtilities.cropImage(img, 11, 11, 11, 10);
}
BufferedImage newImage = new BufferedImage( img.... |
7dc68b17-3fa0-4860-96b0-1dd57b74f6e1 | 0 | public void setStatus(String status)
{
this.status = status;
} |
1cce70a0-01db-40da-8705-468f84b04b31 | 8 | @Override
protected void buildModel() throws Exception {
last_loss = 0;
// number of iteration cycles
for (int iter = 1; iter <= numIters; iter++) {
loss = 0;
// each cycle iterates through one coordinate direction
for (int j = 0; j < numItems; j++) {
// find k-nearest neighbors
Collection<I... |
d3f2fe43-d415-4d7f-895c-9a8d96376b2d | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Board that = (Board) o;
for (int x = 0; x < BOARD_SIZE; x++) {
for (int y = 0; y < BOARD_SIZE; y++) {
if (! this.board[x][... |
53f36c72-3fd3-432f-b1bc-ea0bed93e19f | 4 | private boolean Bump(){
for(Plane p : m_room.getPlanes()){
if(Math.sqrt((this.getX() - p.getX())*(this.getX() - p.getX()) + (this.getY() - p.getY())*(this.getY() - p.getY())) <= m_r*2 ){
/*List<Interval> my_sides = GetSides(m_velocity, m_coordinates);
List<Interval> e... |
996813db-84d9-41a7-a75c-d2f14b365344 | 8 | private static HashMap<String, Holder> getHolders() throws Exception
{
HashMap<String, Holder> map = new HashMap<String, Holder>();
BufferedReader reader= new BufferedReader(new FileReader(new File(ConfigReader.getSaccharineRatDir() +
File.separator + "mergedMapBrayCurtisPCOA.txt")));
reader.readLine(... |
c18af0c2-0838-4fd9-971e-4e71f4d1b78d | 0 | public static void main(String[] args) throws InterruptedException,
ExecutionException {
CallableDemo callableDemo = new CallableDemo();
callableDemo.test();
} |
619ad56b-f65c-4328-8f0a-0c4967f0ca49 | 7 | static double incompleteBetaFraction1( double a, double b, double x ) {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, thresh;
int n;
k1 = a;
k2 = a + b;
k3 = a;
k4 = a + 1.0;
k5 = 1.0;
k6 = b - 1.0;
k7 = k4;
k8 = a +... |
e9b98d06-98ba-42f8-ba2a-a9b304dccdd2 | 5 | @SuppressWarnings("unchecked")
public synchronized long generateNodeId(String key, Coordinate c, List<String[]> tags, List<String> shapes){
Coordinate coor = new Coordinate(round(c.x,7), round(c.y,7));
Long id = null;
if (totalNodes.get(key) == null)
totalNodes.put(key, new ConcurrentHashMap<NodeOsm, Long>... |
f838a5d0-e303-404e-82fc-af4776231d72 | 7 | private Statement parseStatement()
throws SyntaxError, IOException
{
Statement result = null;
Token token = scanner.getCurrentToken();
switch (token) {
case IF:
result = parseIfStatement();
break;
case WHILE:
result = parseWhileStatement();
break;
case SET:
result = parseSetStatemen... |
e26b7d78-dfb1-49cf-b1fe-1f2ff07ab611 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... |
3f220731-5352-4595-af45-627c35f8889d | 2 | @Override
public Iterator<FlipMove> getMoves()
{
ArrayList<FlipMove> moves = new ArrayList<FlipMove>();
for (FlipMove fm : FlipMove.values())
{
if ( isTraversable( fm.dx, fm.dy ) )
{
moves.add( fm );
}
}
return moves.iterator();
} |
2193e470-0ae9-4a66-9e63-bdbf8d988eb6 | 7 | private DoubleInterval nextNorm(DoubleIntervalCohoMatrix A_trans_base, Matrix x, Matrix y,double currNorm){
try{
DoubleIntervalMatrix pi = A_trans_base.getSolution(x);
DoubleIntervalMatrix eta = A_trans_base.getSolution(y);
DoubleInterval newNorm = DoubleInterval.create(Double.MAX_VALUE);
boolean nex... |
e7724c32-b1ef-4ff8-8c93-ac9cb1506dfa | 7 | public byte[] decode(final byte[] EM) {
// Separate the encoded message EM into an
// octet string PS consisting of nonzero octets and a message M as
//
// EM = 0x00 || 0x02 || PS || 0x00 || M.
//
// If the first octet of EM does not have hexadecimal value 0x00, if
// the secon... |
8627d0f7-2791-4a91-8e71-90c0bb5630f0 | 7 | public String playerWaddleToExact(int r, int c)
{
queueTiles.clear();
Tile t = location.grid.getTile(r,c);
if (sortie != null)
{
if (!sortie.land.contains(t))
{
return "You cannot use a sortie unit outside its city.";
}
}
if (t != null)
{
if (t.owner == null)
{
waddleToExact(r,c); ... |
d15409ea-c756-4dc7-ada2-0fed6ea74e64 | 0 | public static void updateProgressBar(final long bytes) {
progressBar.setValue((int) bytes);
statusPanel.revalidate();
statusPanel.repaint();
} |
f7395f1d-7b6a-4e13-ae3c-96648c8fcde9 | 2 | private String name(ClassNode c) {
int id = id(c);
int level = Renamer.ctx.module.getLevel(c);
if (level == 1) {
return "Class" + id;
} else {
StringBuilder name = new StringBuilder();
String superName = Renamer.ctx.module.getRefactorer().getClass(
new ID(c.superName));
if (superName != null) ... |
83bf2a44-7a1c-4d92-9de4-7be7cfd2a6bd | 9 | private void load(InputStream in, String tileSetsLocation) throws SlickException {
tilesLocation = tileSetsLocation;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setEntityReso... |
ad2ecc39-64c4-4b27-9c9c-cd5bc6dd0599 | 7 | public void clusterDocument(Document doc) throws Exception{
Transaction tx = graphDb.beginTx();
try {
ArrayList<Sentence> sentencesList = doc.getSentences();
// these tables will be used to calculate the similarity between the new document and existing cluster
Hashtable<String, Double> clusterSimilairtyTable... |
dc49f6d3-9bbf-4613-b29d-875e81f614d1 | 8 | @Override
protected void write(final Object value) throws IOException {
String stringValue = "";
if (value != null) {
// TODO DO: format the value
if (value instanceof BigDecimal) {
final BigDecimal bd = (BigDecimal) value;
stringValue = bd.si... |
922225a9-cb30-49ff-bcdf-dadd3cbb891e | 8 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new FileReader("invite.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("invite.out")));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.par... |
595b1196-a914-4f25-8fe6-d11ae66f52b2 | 3 | public int getLongestPath() {
int node = sink;
int score = 0;
List<Integer> listPath = new ArrayList<Integer>();
int counter = 0;
while (node != source) {
listPath.add(node);
//System.out.println(node);
score = score + findHighestScoreForNode(n... |
bac17ac4-1600-4dfb-8837-ae4c8d7a80b7 | 0 | //@Test(expected=ReaderException.class)
public void testReadArgumentsFail() throws ReaderException {
ConfigurationManager.init("src/test/resources/test.json");
// No key is given, the method should throw an error
ConfigurationManager.read.getItem();
} |
18d03f51-d655-44c7-9690-526480964efd | 2 | public ArrayList<Gebruiker> getBlokkadeDB() {
ArrayList<Gebruiker> getBlokkadeDB = new ArrayList<Gebruiker>();
try {
this.leesDatabase();
statement = con.createStatement();
output = statement.executeQuery("SELECT * FROM gebruiker where blokkade='0'");
while (output.next()) {
int id = output.getI... |
1b04f04f-67d0-4c49-87c5-542d71b1e04e | 2 | public static int[] two2one(int[][] two) {
int[] one = new int[two.length * two[0].length];
for (int i = 0; i < two.length; i++) {
for (int j = 0; j < two[i].length; j++) {
one[i * two[i].length + j] = two[i][j];
}
}
return one;
} |
85c3b7a4-8864-41bd-837f-76b74a1843e9 | 4 | public void swapPaint(int var1) {
if(var1 > 0) {
var1 = 1;
}
if(var1 < 0) {
var1 = -1;
}
for(this.selected -= var1; this.selected < 0; this.selected += this.slots.length) {
;
}
while(this.selected >= this.slots.length) {
this.selected -= t... |
b3062404-0243-4d3c-872f-f43e07406b83 | 0 | public TraceHandler(Object t)
{
target = t;
} |
e2ce1e62-fb1f-4795-b224-e7f02b959698 | 7 | public void moveServo(int servo, int position)
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "moveServo");
return;
}
if (!getOverrideValidation() && servo != RXTXRobot.SERVO1 &... |
ed83ac4b-9f3f-4781-8184-9237018cceb7 | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Jump other = (Jump) obj;
if (captureX != other.captureX) {
return false;
}
if (captureY != other.captureY) {... |
2eea6f07-8e70-4109-81a1-ee0d634cb0cd | 4 | public void setStandardControls(PlayerSprite s, int i) {
switch (i) {
case 0:
s.setColor(Color.RED);
s.setUpKey(KeyEvent.VK_UP);
s.setDownKey(KeyEvent.VK_DOWN);
s.setLeftKey(KeyEvent.VK_LEFT);
s.setRightKey(KeyEvent.VK_RIGHT);
s.setLightsKey(KeyEvent.VK_CONTROL)... |
c36b2264-19d4-4c30-8e82-a7f34866dd31 | 2 | private void buttonPressed() {
if (selectedOption == 0) {
Game.start();
}
if (selectedOption == 1) {
Game.exit();
}
} |
b3e3da39-d044-4a5b-bdf8-9de0a285777c | 2 | public boolean kuutoset(){
for(int i=0; i<5; i++){
if(nopat[i].getValue()==6){
return true;
}
}
return false;
} |
221fc59a-c12c-4099-8f0c-0f1a7c9422b6 | 8 | @Override
public void run()
{
CountDownLatch latch = null;
long lastExtraRequestTime = 0;
try
{
while (fetchStatus)
{
if ( System.currentTimeMillis() - lastExtraRequestTime >= EXTRA_INFO_DELAY )
... |
a609fdd3-ac01-4d98-86f6-7d03bb95271e | 7 | public MinimizedControlPanel(GUI p){
parent = p;
int controlPanelHeight= 25;
this.setMaximumSize(new Dimension(20000, controlPanelHeight));
this.setMinimumSize(new Dimension(20000, controlPanelHeight));
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createRaisedBevelBorder());
buttonP... |
65862d47-defe-48be-ada1-97d37381f6d1 | 5 | private void calcula(){
if(a != 0){
b = Integer.parseInt(sb_b.toString());
switch(operador){
case 1:
resultado = a / b;
txt_console.setText(String.valueOf(resultado));
break;
case 2:
resultado = a * b;
txt_console.setText(String.valueOf(resultado));
break;
case 3:
resultado... |
964ab5bd-44ad-4a3d-acb2-788c37d9b78c | 8 | protected static Nest findNestFor(Fauna fauna) {
//
// If you're homeless, or if home is overcrowded, consider moving into a
// vacant lair, or building a new one.
final World world = fauna.world() ;
final float range = forageRange(fauna.species) ;
if (crowdingFor(fauna) > 0.5f) {
Nest b... |
34795482-19f0-472e-889e-a480066b405d | 6 | public static int [] getLanguages (Device dev)
throws IOException
{
byte buf [] = null;
try {
buf = getStandardDescriptor (dev,
Descriptor.TYPE_STRING,
(byte) 0, 0, 256);
} catch (USBException e) {
// devices without strings stall here
if (!e.isStalled ())
throw e;
}
if (buf == null |... |
64554c91-fff8-4807-81fb-4ac2053c49cf | 9 | public void transfromHeadline()
{
if(this.hlDepth > 0)
return;
int level = 0;
final Line line = this.lines;
if(line.isEmpty)
return;
int start = line.leading;
while(start < line.value.length() && line.value.charAt(start) == '#')
{
... |
404765df-c0a4-4785-a932-101e606b00f5 | 4 | public void close(){
try{
if(prst != null){
prst.close();
prst = null;
}
if(connectioncon != null){
connectioncon.close();
connectioncon = null;
}
if(rese != null){
rese.close();
rese = null;
}
}
catch(Exception ex){
System.err.println("close error ... |
e83eb106-6c64-4581-9930-1499896d3681 | 5 | public ImageOptimize(String domain, int size) {
if (domain == null || domain.isEmpty())
return;
if (size <= 0)
return;
if (!domain.startsWith("http://"))
domain = "http://" + domain;
try {
document = Jsoup.connect(domain).get();
this.size = size;
} catch (IOException e) {
e.printStackTrace... |
40fbcda1-828b-4ae6-bb06-3fa5d3f8fed7 | 9 | public Mailinglist(Element mailinglist) throws ConfigFormatException {
if (!mailinglist.getName().equals("mailinglist")) {
throw new IllegalArgumentException(
"Wrong tag name for root element");
}
name = mailinglist.getAttributeValue("name");
if (name == ... |
be469dc5-3c2b-4480-9aa3-7567e7deb410 | 6 | private Valor procura(No x, Chave chave, int ht) {
Entrada[] children = x.filhos;
// no externo
if (ht == 0) {
for (int j = 0; j < x.numFilhos; j++) {
if (igual(chave, children[j].chave)) return (Valor) children[j].valor;
}
}
// no intern... |
0b46f78d-2e3e-409f-a82c-6729bc9740b0 | 8 | private void initializeCompactColonyPanel() {
Specification spec = getSpecification();
goodsTypes = new ArrayList<GoodsType>(spec.getGoodsTypeList());
Collections.sort(goodsTypes, goodsComparator);
while (!goodsTypes.get(0).isStorable()
|| goodsTypes.get(0).isTradeGoods()) {
... |
bb5f3609-cc52-4862-9fdd-58a8662d0440 | 5 | protected boolean closeResources() {
try {
if( conn != null && !conn.isClosed() ) {
// This will roll the transaction back if there was a transaction active.
if( inTransaction && conn.getAutoCommit() == false ) {
logger.warn("Automatically rolling back the transaction.");
conn.rollback();
}
... |
dd536aca-7666-43ff-bea8-2b4cb161f38c | 6 | @Override
protected void bindToModelModifications() {
keySystemModel.addPropertyChangeListener(
keySystemModel.getPropertyName(), new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!lock)
pKeyboard.loadVK((TagAndURISubModel[]) evt
... |
fb0035c7-81a3-4e06-9462-69debc648b59 | 8 | private void moveGameUp(){
int index = gameList.getSelectedIndex();
if(index > 0){
byte movedGameId = games[index-1];
// Update the active games array
if(Utils.getIndex(activeGames, games[index]) != -1){
int movedGame... |
32be2470-c9aa-458b-884e-9b045b9469a3 | 1 | public StorageManager(String dir, int capacityPerBlock, int initNumberOfBlocks, StorageMode storageMode, double dirtyRatioThreshold,
long maxOffHeapMemorySize) throws IOException {
this.dir = dir;
this.capacityPerBlock = capacityPerBlock;
this.dirtyRatioThreshold = dirtyRatioThre... |
5ceff406-b4cb-4ad1-80ed-ed4c3d800de0 | 9 | public String getMimeByExtension(String filename)
{
String type=null;
if (filename!=null)
{
int i=-1;
while(type==null)
{
i=filename.indexOf(".",i+1);
if (i<0 || i>=filename.length())
break;
... |
2ba035d5-5228-4391-b047-451a373ee0c3 | 2 | @Override
public void actionPerformed(ActionEvent event) {
if (mURI != null) {
try {
Desktop.getDesktop().browse(mURI);
} catch (IOException exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
} |
aab00122-0a2d-4bd9-ad20-8bccdc9fedf4 | 2 | private void switchPlayer() {
// This ugly construct serves to switch the current player.
for(Player p : players) {
if(currentPlayer != p) {
currentPlayer = p;
break;
}
}
} |
47a00055-52e1-4fc3-a0fc-c7a07212a24d | 0 | public void setView(AutomatonPane view){
myView = view;
} |
75044c16-1de6-41fc-9685-034e1a8a5465 | 0 | @Override
public void touchPower() {
System.out.println("A师傅,开到80迈!");
} |
768a912f-be6b-46a9-a666-7347af0bad36 | 2 | public void createPlatform(int x, int y, int w, int h){
for(int i = x; i < x+w; i++){
for(int j = y; j < y+h; j++){
grid[j][i].color = Color.red;
grid[j][i].solid = true;
}
}
} |
bf7371b9-5f51-4903-a41b-5613c86ad99e | 7 | public static void printlocOutDegVsNthPercentilePersonSocScore(int percentile){
HashMap<Integer,Integer> outDegree = new HashMap<Integer,Integer>(numLocations);
HashMap<Integer,Integer> soc = new HashMap<Integer,Integer>(numLocations);
try {
Connection con = dbConnect();
Statement getOutDeg = con.createStat... |
5e82e0f5-57ac-4f99-a58c-a85e58f39013 | 6 | public int findNumberInString(String in){
int pos = 0;
int start = -1;
int stop = -1;
while(pos < in.length() )
{
if(isNumber(in.codePointAt(pos)))
{
if(start == -1)
{
start = pos;
}
... |
b0754922-315e-4220-ade7-4e3ddd22f99b | 4 | public static boolean hasStrength(Pokemon[] pokemon)
{
for (Pokemon aPokemon : pokemon) {
if (aPokemon != null) {
for (int j = 0; j < 4; j++) {
if (aPokemon.move[j] == Pokemon.Move.STRENGTH)
return true;
}
}
... |
e4b5852d-36b1-4984-af53-073708755e83 | 7 | private void createContentPane() {
if (contentPane != null)
return;
contentPane = new JPanel(new BorderLayout());
JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(p, BorderLayout.SOUTH);
String s = Modeler.getInternationalText("OKButton");
JButton button = new JButton(s != nul... |
4a463c5e-ed01-4da8-b6fb-268d7cdd56a3 | 8 | public void run() {
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
try {
nextpoints();
runtotal++;
// do more calculations per paint later on
if (runtotal > 400) {
nextpoints();
nextpoints();
}
long denom = rejected + accepted;
if (denom > 0)
... |
da52e14b-0084-46bf-b085-16b75c8c7bef | 1 | public Collection operands() {
if (operands != null) {
operands.keySet().retainAll(preds());
return operands.values();
}
return new ArrayList();
} |
cbf750eb-87aa-4d8d-b107-e7702d94e901 | 9 | int calculateWeight(FullTextQuery query)
{
switch (query.op) {
case FullTextQuery.AND:
{
return calculateWeight(((FullTextQueryBinaryOp)query).left);
}
case FullTextQuery.NEAR:
{
int shi... |
d47d2e92-6004-41d4-a802-0cc7a1f4679c | 2 | public Module createModuleChain(List<String> chain) {
int index = 0, size = chain.size();
Module module = getRootModule();
while(index < size) {
String name = chain.get(index++);
if (null == module.getSubModule(name)) {
module.addSubModule(new Module(name));
}
module = module.getSubModule(name);
... |
91e75058-f743-4d4e-8f65-d36166423175 | 1 | public Map<String, String> getStyles() {
if (styles == null) {
styles = new HashMap<String, String>();
}
return styles;
} |
3b79d195-d9ce-41da-bc2a-12cdc9d21219 | 9 | public void buyStock(String symbol, int quantity)
throws
StockNotExistException,
BalanceException
{
if (quantity<-1)
{
throw new BalanceException("you cannot buy a negative amount!");
}
for (int i=0;i<this.portfolioSize;i++)
{
if (symbol==this.stockStatuses[i].getSymbol())
{
if (this.sto... |
e6c08b41-411d-449d-81be-e3d9913f6314 | 9 | public JSONEventType next() throws IOException {
JSONEventType type = null;
do {
set(null, null, false);
switch (state) {
case BEFORE_ROOT:
state = beforeRoot();
break;
case AFTER_ROOT:
state = afterRoot();
break;
case BEFORE_NAME:
state = beforeName();
break;
case AFTER_NA... |
387e69a6-4eea-4833-ba09-f450ce082f6e | 5 | public static void addListeners(EventListener... es) {
if (es == null)
return;
for (EventListener e : es) {
if (e == null)
continue;
if (!listeners.contains(e)) {
EventManager m = getEventManager();
if (m != null) {
m.addListener(e);
listeners.add(e);
}
}
}
} |
61188057-ad27-4098-b34d-e744d1f76246 | 1 | @Override
public void setSelected(boolean selected) {
// TODO Adapt these into some kind of const accessible from an exterior system for color coordination
if(selected) {
textColor = "white";
} else {
textColor = "gray";
}
} |
2c77ed4d-bd30-447e-ad4d-14524e9696fb | 3 | public Expression negate() {
if (getOperatorIndex() == LOG_AND_OP || getOperatorIndex() == LOG_OR_OP) {
setOperatorIndex(getOperatorIndex() ^ 1);
for (int i = 0; i < 2; i++) {
subExpressions[i] = subExpressions[i].negate();
subExpressions[i].parent = this;
}
return this;
}
return super.negate(... |
1fa944ee-f91c-4a2b-83d1-62223508b30f | 5 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
this.grille.gauchePiece();
break;
case KeyEvent.VK_RIGHT:
this.grille.droitePiece();
break;
case KeyEvent.VK_U... |
8d2c8651-2b23-4458-b4a8-d6789cffcd1e | 9 | private void startClientMonitor(){
while(noStopRequested){
try {
if(this.timeOut > 0){// 超时阀值
Iterator<Object> it = clients.keySet().iterator();
while(it.hasNext()){
try{
Object key = it.next();
Client client = clients.get(key);
if(client.getReadStatus() == 1... |
dd118cc7-36c3-4553-ad59-3e45d71c18c5 | 0 | public void addFile (File file){
this.dbFile.add(file);
} |
379d2e9d-735a-476d-8037-41a1058acd34 | 7 | protected boolean connectFour()
{
for (int i = 0; i < GameConstants.NUM_ROWS; i++)
{
for (int j = 0; j < GameConstants.NUM_COLUMNS; j++)
{
if (boardArray[i][j] == null)
{
continue;
}
if (vertical(i, j)
||horizontal(i, j)
||diagonalUp(i, j)
... |
022d49af-501e-45b2-b0f5-08b6aa38f4e1 | 3 | SubList(int fromIndex, int toIndex) {
if (fromIndex < 0)
throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
if (toIndex > size())
throw new IndexOutOfBoundsException("toIndex = " + toIndex);
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" ... |
f058b3f5-af5c-48bc-93d4-a3a2c5b682be | 0 | @Override public void finishPopulate()
{
} |
afd177c3-2442-4a56-ac28-8907d3b96114 | 6 | private void intializeGrammarTableSetting()
{
grammarTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
grammarTable.addKeyListener(new KeyListener(){
public void keyPressed(KeyEvent e) {
}
// when user realease a key that means user might or might not selected an item from the list
publi... |
317fbdf2-5ee9-4ab1-b2b7-5f0842821d72 | 7 | private void quit()
{
List<SpecificationDocument> allSpecifications = allSpecifications();
boolean hasEditedDocuments = hasEditedDocuments(allSpecifications);
String applicationQuitTextKey = hasEditedDocuments ? "application.quit.edited.message" : "application.quit.message";
int dial... |
1aba69d1-fcda-4b39-9066-84644c770705 | 2 | public void calculateBounds() {
if (A.getX() < B.getX()) {
lowerX = A;
higherX = B;
} else {
lowerX = B;
higherX = A;
}
if (A.getY() < B.getY()) {
lowerY = A;
higherY = B;
} else {
higherY = A;
... |
cdd5f05c-40fd-4349-a21b-88d8995f157d | 8 | public void render(Graphics g) {
if (shouldRender) {
HUDArea hudArea = null;
if (bgColor != null) {
g.setColor(bgColor);
g.fillRect(positionX, positionY, width, height);
}
if (bgImage != null) {
g.drawImage(bgImage... |
9b683a25-b8d8-400f-ac05-4240e36863eb | 4 | public File chooseGrammarDialog(final File cur) {
File dir = cur;
if(dir == null || !dir.exists()) {
dir = INI.getObject("last", "grammarDir", Converter.FILE_CONVERTER, HOME_STR);
}
final JFileChooser choose = new JFileChooser(dir);
choose.setMultiSelectionEnabled(false);
choose.setFileSel... |
74fc3191-5f26-45a4-810b-96b739e5a49f | 5 | public double SchneidetMit(Gerade3D g) {
Vector3d p12 = new Vector3d(p2.x - p1.x, p2.y - p1.y, p2.z - p1.z), p13 = new Vector3d(
p3.x - p1.x, p3.y - p1.y, p3.z - p1.z), n = new Vector3d();
n.cross(p12, p13);
if (g.Richtungsvektor.dot(n) != 0) {
Vector3d x = this.SchnittpunktMitGerade(g);
if ((x.x <= 1... |
e8ab038c-6815-4563-8c42-f4c28e7b3418 | 1 | public void start() {
//spawnDelay = 5000; // default delay between enemy spawns
totalElapsedTime = 0;
//sinceLastSpawn = 0;
//currentBossID = NO_BOSS;
bossCount = 0;
bossPool.clear();
for(int i = 1; i <= 5; i++) {
bossPool.add("assets/data/ac... |
31c99450-16af-4e2d-9874-b1e485bbacef | 5 | @Override
public void onSet(Player player, String value) {
short data = 0;
int amount = 1;
if (value.contains(";")) {
try {
amount = Integer.parseInt(value.split(";")[1]);
value = value.split(";")[0];
} catch (Exception e) {
player.sendMessage(ChatColor.RED + value.split(";")[1] + " isn't a ... |
36a59944-a779-4b6a-b3c6-4be435371256 | 3 | private void loadDataFromFile(String file, InstanceType type) throws IOException
{
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
String line = null;
while((line = br.readLine()) != null)
{
String[] tks = line.trim().split("[\t]+");
int id = Integer.parseInt(tks[0]);... |
1d88a9f5-60eb-4f5d-acf1-edd8acbb4686 | 8 | void scheduleUpdate() {
if (!dynamic) return;
if (updating) return;
// trace("consider update", this);
int load = queueLength + 1;
for (int l=0; l<maxLevel; l++) {
// look for changes
for (int z=0; z<maxOrder; z++) {
double now = delay[l][z... |
77c38db3-ae19-40bc-8de0-80e56c2cf925 | 4 | public boolean removeAdmin(User invoker, User adminToRemove) {
if (!invoker.hasPermission(Permissions.REMOVE_ADMIN)) return false;
boolean found = false;
for (int i=0; i<administrators.size() && !found; i++) {
if (administrators.get(i) == adminToRemove) {
found = true;
administrators.remove(i);
sa... |
efbba8a1-c010-4b24-ae08-ec232fb272d2 | 8 | @SuppressWarnings("unused")
private UserSimilarity getSimilarityFor(DataModel dataModel, int i) throws TasteException {
switch (i) {
case 0 :
return new PearsonCorrelationSimilarity(dataModel);
case 1 :
return new PearsonCorrelationSimilarity(dataModel, Weighting.WEIGHTED);
case 2:
return new Sp... |
17be0c7e-25c9-4e28-9d23-b7757b59a154 | 4 | protected void move() {
float ex = getEnemyXPos();
float ey = getEnemyYPos();
this.increaseSpeed();
PApplet app = getApp();
t -= .02;
if (app.noise(t) < .5) {
for (int i = 0; i < 15; i++) {
rotateLeft();
}
} else {
rotateRight();
}
if (getSpeed() < 4) {
increaseSpeed();
}
if (ca... |
d006f378-661f-43e3-b5d4-9c9b84ae7293 | 8 | public static String getGmWiki(String arg)
{
String url = "http://wiki.yoyogames.com/index.php/" + arg;
String def = null;
Scanner sc = null;
HttpURLConnection conn = null;
try
{
conn = (HttpURLConnection) (new URL(url).openConnection());
// Set up a request.
conn.setConnectTimeout(5000); // 5... |
57917c7b-39f6-4ba1-9233-b51727ea4b1b | 2 | public void unregister_endpoints(SocketBase socket_) {
endpoints_sync.lock ();
try {
Iterator<Entry<String, Endpoint>> it = endpoints.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Endpoint> e = it.next();
if (e.getValue().so... |
5ef7b29f-caa4-4c79-8697-686408618e06 | 1 | private static long getOffset() {
try {
return $.objectFieldOffset(UnsafePointer.class.getField("o"));
} catch (NoSuchFieldException e) {
throw new UnsupportedOperationException("Unsupported JVM - can't get field offset", e);
}
} |
b4b87bbf-96fc-4c91-a0d3-f62c8f404b1c | 8 | private void registerChannelOnThisThread(
RegisterableChannelImpl channel, int validOps, Object listener)
throws ClosedChannelException {
if(channel == null)
throw new IllegalArgumentException("cannot register a null channel");
else if(!Thread.currentThread().equals(selector.getThread()))
thro... |
51c35ae2-19e5-481c-8847-79b66f6776df | 2 | boolean[][] threshold(double[][] array, double threshold) {
boolean[][] result = new boolean[array.length][array[0].length];
for(int i = 0; i < result.length; ++i) {
for(int j = 0; j < result[i].length; ++j) {
result[i][j] = array[i][j] >= threshold;
}
}
return result;
} |
209d38e9-a73f-4600-b289-6d83c4a8b363 | 6 | public static void enforce(Window window) {
Dimension origSize = window.getSize();
Dimension otherSize = window.getMinimumSize();
int width = origSize.width;
int height = origSize.height;
if (width < otherSize.width) {
width = otherSize.width;
}
if (height < otherSize.height) {
height = otherSize.h... |
5470207b-3d8d-4042-8140-d69f42f43114 | 2 | public MonInterface (Lanceur lanceur){
this.lanceur = lanceur;
conteneurNiv1_1 = new JPanel();
conteneurNiv2_1 = new JPanel();
conteneurNiv3_1 = new JPanel();
conteneurNiv4_1 = new JPanel();
conteneurNiv4_2 = new JPanel();
//disign5_1 = new JPanel();
conteneurNiv5_1 = Box.createVerticalBox();
conte... |
90fe4456-00f2-44c6-b8d6-4953cd63b882 | 0 | public boolean[] getNextCells() {
return nextCells;
} |
e930f87e-704d-45bf-a5d3-40ab40f3a5b3 | 6 | @Override
public void solve( DenseMatrix64F B , DenseMatrix64F X ) {
if( B.numCols != X.numCols && B.numRows != n && X.numRows != n) {
throw new IllegalArgumentException("Unexpected matrix size");
}
int numCols = B.numCols;
double dataB[] = B.data;
double dataX[... |
e8d63514-18ed-4883-b935-99a0fbd10820 | 2 | public int sqrt3(int x) { // newton's method
if(x == 0) return 0;
// f(t) = t^2 - x; f'(t) = 2t;
// t' = t - f(t) / f'(t) = t - (t^2 - x) / 2t = (t + x / t) / 2;
// t' = (t + x / t) / 2
double t = 1.0;
double former = 0.0;
while(t!=former){
former = t;
// t + x/t get... |
f74c40cd-3fe3-4c65-a17e-15869b590ce7 | 1 | public void run(boolean debugMode) {
Program program = bcl.loadCodes();
VirtualMachine vm;
if (debugMode) {
vm = new DebuggerVirtualMachine(program, sourceLines);
(new UserInterface()).run((DebuggerVirtualMachine) vm);
} else {
vm = new VirtualMachine(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.