text stringlengths 14 410k | label int32 0 9 |
|---|---|
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>(... | 5 |
@Override
public void execute(VirtualMachine vm) {
super.execute(vm);
((DebuggerVirtualMachine) vm).exitFunction();
} | 0 |
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... | 6 |
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.... | 1 |
public void setStatus(String status)
{
this.status = status;
} | 0 |
@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... | 8 |
@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][... | 6 |
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... | 4 |
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(... | 8 |
public static void main(String[] args) throws InterruptedException,
ExecutionException {
CallableDemo callableDemo = new CallableDemo();
callableDemo.test();
} | 0 |
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 +... | 7 |
@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>... | 5 |
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... | 7 |
@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... | 9 |
@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();
} | 2 |
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... | 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... | 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); ... | 7 |
public static void updateProgressBar(final long bytes) {
progressBar.setValue((int) bytes);
statusPanel.revalidate();
statusPanel.repaint();
} | 0 |
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) ... | 2 |
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... | 9 |
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... | 7 |
@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... | 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... | 8 |
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... | 3 |
//@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();
} | 0 |
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... | 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;
} | 2 |
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... | 4 |
public TraceHandler(Object t)
{
target = t;
} | 0 |
public void moveServo(int servo, int position)
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "moveServo");
return;
}
if (!getOverrideValidation() && servo != RXTXRobot.SERVO1 &... | 7 |
@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) {... | 9 |
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)... | 4 |
private void buttonPressed() {
if (selectedOption == 0) {
Game.start();
}
if (selectedOption == 1) {
Game.exit();
}
} | 2 |
public boolean kuutoset(){
for(int i=0; i<5; i++){
if(nopat[i].getValue()==6){
return true;
}
}
return false;
} | 2 |
@Override
public void run()
{
CountDownLatch latch = null;
long lastExtraRequestTime = 0;
try
{
while (fetchStatus)
{
if ( System.currentTimeMillis() - lastExtraRequestTime >= EXTRA_INFO_DELAY )
... | 8 |
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... | 7 |
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... | 5 |
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... | 8 |
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 |... | 6 |
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) == '#')
{
... | 9 |
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 ... | 4 |
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... | 5 |
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 == ... | 9 |
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... | 6 |
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()) {
... | 8 |
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();
}
... | 5 |
@Override
protected void bindToModelModifications() {
keySystemModel.addPropertyChangeListener(
keySystemModel.getPropertyName(), new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!lock)
pKeyboard.loadVK((TagAndURISubModel[]) evt
... | 6 |
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... | 8 |
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... | 1 |
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;
... | 9 |
@Override
public void actionPerformed(ActionEvent event) {
if (mURI != null) {
try {
Desktop.getDesktop().browse(mURI);
} catch (IOException exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
} | 2 |
private void switchPlayer() {
// This ugly construct serves to switch the current player.
for(Player p : players) {
if(currentPlayer != p) {
currentPlayer = p;
break;
}
}
} | 2 |
public void setView(AutomatonPane view){
myView = view;
} | 0 |
@Override
public void touchPower() {
System.out.println("A师傅,开到80迈!");
} | 0 |
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;
}
}
} | 2 |
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... | 7 |
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;
}
... | 6 |
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;
}
}
... | 4 |
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... | 7 |
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)
... | 8 |
public Collection operands() {
if (operands != null) {
operands.keySet().retainAll(preds());
return operands.values();
}
return new ArrayList();
} | 1 |
int calculateWeight(FullTextQuery query)
{
switch (query.op) {
case FullTextQuery.AND:
{
return calculateWeight(((FullTextQueryBinaryOp)query).left);
}
case FullTextQuery.NEAR:
{
int shi... | 9 |
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);
... | 2 |
public Map<String, String> getStyles() {
if (styles == null) {
styles = new HashMap<String, String>();
}
return styles;
} | 1 |
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... | 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... | 9 |
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);
}
}
}
} | 5 |
@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";
}
} | 1 |
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(... | 3 |
@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... | 5 |
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... | 9 |
public void addFile (File file){
this.dbFile.add(file);
} | 0 |
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)
... | 7 |
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(" ... | 3 |
@Override public void finishPopulate()
{
} | 0 |
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... | 6 |
private void quit()
{
List<SpecificationDocument> allSpecifications = allSpecifications();
boolean hasEditedDocuments = hasEditedDocuments(allSpecifications);
String applicationQuitTextKey = hasEditedDocuments ? "application.quit.edited.message" : "application.quit.message";
int dial... | 7 |
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;
... | 2 |
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... | 8 |
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... | 4 |
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... | 5 |
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... | 1 |
@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 ... | 5 |
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]);... | 3 |
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... | 8 |
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... | 4 |
@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... | 8 |
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... | 4 |
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... | 8 |
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... | 2 |
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);
}
} | 1 |
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... | 8 |
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;
} | 2 |
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... | 6 |
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... | 2 |
public boolean[] getNextCells() {
return nextCells;
} | 0 |
@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[... | 6 |
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... | 2 |
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(... | 1 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.