text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int getMessageId() {
if (messageId == -1) {
messageId = nextId();
}
return messageId;
} | 1 |
public static void main(String[]args){
int[] numbers = new int [5];
Scanner scanner = new Scanner(System.in);
/*for (int i=0; i<5; i++)
{
System.out.println("Write numbers[" + i + " ] = ");
numbers[i] = scanner.nextInt();
System.out.println(verifyIfNumberIsPrime(numbers[i]))... | 9 |
public String[] getInterfaces() {
if (cachedInterfaces != null)
return cachedInterfaces;
String[] rtn = null;
if (interfaces == null)
rtn = new String[0];
else {
int n = interfaces.length;
String[] list = new String[n];
for (in... | 3 |
public static ServiceTime getServiceTime(Address srcAddr, Address dstAddr) {
ServiceTime serviceTime = new ServiceTime();
serviceTime.setSrcAddr(srcAddr);
serviceTime.setDstAddr(dstAddr);
String url = "http://www.sf-express.com/dwr/call/plaincall/ServiceTimeManager.getServiceTime_omp.dwr";
List<NameValuePair>... | 8 |
public void changeController(EU2Country country) {
String sid = go.getString("id");
boolean b = false;
EU2Country prevController = null;
for (int i = 0; i < scenario.numCountries() && !b; i++) {
GenericList provs = scenario.getCountry(i).go.getList("controlledprovinc... | 5 |
@SuppressWarnings("unchecked")
@Override
public E get(int index) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException("Index " + index + "for size "
+ size + " is out of bounds");
}
return (E) data[index];
} | 2 |
void initKey(Integer[] kcs) {
for (int i = 0; i < kcs.length; i++) {
try {
keyMapping.put(kcs[i], Board.class.getMethod(methodName[i]));
} catch (NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
} | 2 |
public void load() {
try {
// First do checks to create the initial file
if(!file.exists()) {
if(file.getParentFile()!=null)
file.getParentFile().mkdirs();
if(file.createNewFile())
super.save(file);
else
throw new Exception("Cannot load: File can not be created!");
}
// Then do checks to save... | 4 |
private void checkTreeMembership(Position<T> pos) {
if (!(pos instanceof GeneralTreeNode)
|| !((GeneralTreeNode<T>) pos).sameTree(this)) {
throw new IllegalArgumentException("Invalid position for this "
+ "tree.");
}
} | 2 |
public void selectNextgenaration() {
List<MaxOneChromosome> nextGen = new ArrayList<MaxOneChromosome>();
// Copy over a portion of the population unchanged, based on
// the elitism ratio.
int idx = Math.round(this.size() * elitism);
for (int i = 0; i < idx; i++) {
... | 7 |
public void setStats(boolean forceNewStats, Stats stats)
{
switch(stats.getMode())
{
case 0:
setStatsOsuStandard(forceNewStats, stats);
return;
case 1:
setStatsTaiko(forceNewStats, stats);
return;
case 2:
setStatsCTB(forceNewStats, stats);
return;
case 3:
setStatsOsuMania(fo... | 4 |
public void run() {
byte[] ack_buffer = new byte[ACK_SIZE];
do {
try {
ack_buffer = new byte[ACK_SIZE];
DatagramPacket receivePacket = new DatagramPacket(
ack_buffer, ack_buffer.length);
clientSocket.receive(receivePacket);
} catch (Exception e) {
}
int ack_num = Utilities.ge... | 3 |
protected synchronized void flushAndClose( int code, String message, boolean remote )
{
if ( flushandclosestate )
{
return;
}
closecode = code;
closemessage = message;
closedremotely = remote;
flushandclosestate = true;
wsl.onWriteDemand( this ); // ensures that all outgoing frames are flushed... | 3 |
public boolean setOption( String op, String val )
{
if( op.equals( "crossesAt" ) ) // specifies where axis crosses (double value
{
catCross = Short.valueOf( val );
}
else if( op.equals( "orientation" ) )
{ // axis orientation minMax or maxMin -- fReverse
fReverse = (val.equals( "maxM... | 9 |
int insertKeyRehash(short val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look ... | 9 |
public static boolean almostEquals(double v1, double v2) {
if (v1 == v2) {
return true;
}
if (Double.isNaN(v1) || Double.isNaN(v2) || Double.isInfinite(v1) || Double.isInfinite(v2)) {
return false;
}
long bits1 = Double.doubleToLongBits(v... | 8 |
public MainView(Piece[][] board){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(0, 0, 1150, 870);
boardPane = new JLayeredPane();
boardPane.setBounds(100, 100,800,800);
getContentPane().add(boardPane);
this.addMainMenuBar();
chessBoard = new JPanel();
chessBoard.set... | 6 |
private JComponent drawDialogPane() {
// Create the panel
JPanel panel = new JPanel();
panel.setLayout(new GridLayout());
panel.setBorder(BorderFactory.createTitledBorder("Product"));
//Getting items from warehouse tab
StockItem[] items = new StockItem[model.ge... | 1 |
private boolean insertBlock(Block gameBlock) {
if (!gameBlock.insert(gameGrid)) {
--lives;
if (lives != 0) {
gameGrid.wipe();
return gameBlock.insert(gameGrid);
}
return false;
}
return true;
} | 2 |
public static void startupClassify() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mod... | 7 |
public void createNewarea(int x, int y, String areaName) {
int i, j = 0;
Room r = null;
Vector<Room> newRoomList = new Vector<Room>();
for (i = 0; i < x; i++) {
for (j = 0; j < y; j++) {
System.out.print("make room" + String.valueOf(i) + '-'
+ String.valueOf(j));
r = new Room();
r.init();... | 9 |
public NoeudItineraire rechercheNoeudLivraisonPrecedent(Livraison livraison){
int idxPremierePlageNonVide = 0;
for(int idxPlage=0; idxPlage< this.plagesHoraire.size(); idxPlage++){
List<Livraison> listeLivraison = this.plagesHoraire.get(idxPlage).getAllLivraison();
if(listeLivraison.size() == 0){
idxPremi... | 5 |
private void eltran(double[][] a, double[][] zz, int[] ordr, int n) {
int i, j, m;
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
zz[i][j] = 0.0;
zz[j][i] = 0.0;
}
zz[i][i] = 1.0;
}
if (n <= 2) {
... | 7 |
@Override
public void deserialize(Buffer buf) {
rank = buf.readShort();
if (rank < 0 || rank > 2300)
throw new RuntimeException("Forbidden value on rank = " + rank + ", it doesn't respect the following condition : rank < 0 || rank > 2300");
bestDailyRank = buf.readShort();
... | 8 |
public void start() {
if (this.cPointer == 0) {
throw new ClosedException();
}
final int r = ppaml_phase_start(this.cPointer);
switch (r) {
case 0:
break;
case 1:
throw new ClockAcquisitionException();
case 2:
throw ... | 4 |
@Override
public void update(Observable obs, Object obj) {
if (obs == robotInstance.getJoystickHandler()) {
// We've hit a joystick error - disable everything
if (connected) {
robotInstance.getPacketTransmitter().terminate();
jEnableBtn.setEnabled(false);
jEnableBtn.setText("Enable");
jConnectB... | 4 |
public GameWindow getGameWindow() {
boolean test = false;
if (test || m_test) {
System.out.println("Controls :: getGameWindow() BEGIN");
}
if (test || m_test) {
System.out.println("Controls :: getGameWindow() END");
}
return m_gameWindow;
} | 4 |
@Override
/**
* This method will be used by the table component to get
* value of a given cell at [row, column]
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object value = null;
Problem problem = problems.get(rowIndex);
switch (columnIndex) {
case COLUMN_TITLE:
value = problem.getPr... | 4 |
@Override
public int takeStep()
{
fillVariables();
if (gloBallBehindLine(this.gloBall, -0.3, ourField)) {
if (upper) {
goToGloDestination(this.gloMyPosition, this.gloUpperDefensePosition, 0.1);
System.out.println("UPPER: " + this.gloUpperDefensePosition);
} else {
... | 5 |
public boolean equals(Object obj)
{
if(!(obj instanceof Pair))
{
return false;
}
if(obj == this)
{
return true;
}
if(obj.equals(null))
{
return false;
}
@SuppressWarnings("unchecked")
Pair<T, U> p = (Pair<T, U>)obj;
if(p.getFirst() == null || p.getSecond() == null)
{
System.out.pr... | 7 |
public void addAll(Collection<Feature> features)
{
this.features.addAll(features);
} | 0 |
public Integer getInteger(String expression, Object context)
throws XPathExpressionException {
assert(expression != null);
if(context == null) {
assert(document != null);
context = document;
}
return ((Double) xpath.evaluate(expression,
... | 1 |
private static int buildRows(OutlineModel model) {
model.addRow(new OutlineTestRow("First")); //$NON-NLS-1$
model.addRow(new OutlineTestRow("Second, but with a really long piece of non-pre-wrapped text.")); //$NON-NLS-1$
model.addRow(new OutlineTestRow("Third, but with a\nreally long piece\nof pre-wrapped text.")... | 3 |
public static double fTestValueGivenFprob(double fProb, int df1, int df2) {
// Create an array F-test value array
int fTestsNum = 100; // length of array
double[] fTestValues = new double[fTestsNum];
fTestValues[0] = 0.0001D; // lowest array value
fTestValues[fTestsNum - 1] = 10000.0D; // highest array value... | 8 |
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... | 8 |
public void InsertaInicio (int idProceso, String nombreProceso, boolean recibido)
{
if (VaciaLista())
PrimerNodo = UltimoNodo = new NodosListaProceso(nombreProceso);
else
PrimerNodo = new NodosListaProceso(nombreProceso,PrimerNodo );
} | 1 |
private void render()
{
System.out.println("Render");
GridSquare[][] grid = gl.getGrid();
for(int col = 0; col < grid.length; col++)
{
for(int row = 0; row < grid[col].length; row++)
{
if (grid[row][col].player == EPlayer.None)
System.out.print("-");
else if (grid[row][col].player == EPl... | 9 |
public void writeDataFile(String contentToWrite, String personName, String topic) {
// Checks if personName is null of empty
if (personName == null || personName.isEmpty()) {
personName = "All Speakers";
}
// Checks if topic is null or empty
if (topic == null || topi... | 6 |
@Override
public boolean create(Particulier x)
{
String req = "INSERT INTO particulier ( email, motdepasse, nom, prenom, titre, adresse)\n"
+"select \""+x.getEmail()+"\", \""+x.getMotDePasse()+"\", \""+x.getNom()+"\", \""+x.getPrenom()+"\", \""+x.getTitre()+"\", \"... | 4 |
@Override
public void run() {
try {
InputStream in = socket.getInputStream();// read from the socket
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String html;
while (!"".equals((html = reader.readLine()))) {
System.out.println(html);
}
OutputStream out = socket.getOu... | 2 |
boolean clauseChainSpec(int tok) {
if (tok == Token.colon) {
tokenNext();
tok = tokPeek();
if (isSpecTerminator(tok))
return generateResidueSpecCode(new Token(Token.spec_chain, '\0', "spec_chain"));
}
if (tok == Token.asterisk) {
tokenNext();
return true;
}
Token tokenChain;
char chain;
... | 9 |
private Node getOpposite(Node n){
int cur = n.getIndex();
int par = n.getParent().getIndex();
try{
if(cur == par + dim && cur / dim < dim - 1) return nodeMap[cur+dim];
if(cur == par - dim && cur / dim > 0) return nodeMap[cur-dim];
if(cur == par + 1 && cur % dim < dim - 1) return nodeMap[cur+1];
if(cur == par... | 9 |
public static long convert32bitsLittleEndianToUnsignedInt(byte[] d) {
return ((0xff & d[3])<<24) + ((0xff & d[2])<<16) + ((0xff & d[1])<<8) + (0xff & d[0]);
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AlgebraicParticle other = (AlgebraicParticle) obj;
if (exponent != other.exponent)
return false;
if (sign != other.sign)
return false;
... | 5 |
public static boolean isPrinterAvailable2(String printerName) {
DocFlavor myFormat = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
PrintService[] printers = PrintServiceLookup.lookupPrintServices(myFormat, aset);
for (PrintSe... | 2 |
@AfterClass
public static void tearDownClass() {
} | 0 |
private String getTTenNum(){
if ((this.LinkIDNum++) >= 10000000) this.LinkIDNum=0;
String returnnum ="0000000000"+ String.valueOf(this.LinkIDNum);
return returnnum.substring(returnnum.length()-10);
} | 1 |
@Override
public void update(double deltaTime) {
desiredPosition = position.plus(controls.desiredMove());
rechargeTimeRemaining -= deltaTime;
if (controls.shouldFire()){
if (rechargeTimeRemaining <= 0){
Vector2f spawnLocation = position.plus(size.x()/2, 0);
... | 2 |
public static int traversal(TreeNode node, int prefix) {
if (null != node) {
if (null == node.left && null == node.right) {
return prefix * 10 + node.val;
} else if (null == node.left) {
return traversal(node.right, prefix * 10 + node.val);
} else if (null == node.right) {
return traversal(node.l... | 5 |
private Opcode toOpcode(byte opcode) {
switch (opcode) {
case 0:
return Opcode.CONTINIOUS;
case 1:
return Opcode.TEXT;
case 2:
return Opcode.BINARY;
// 3-7 are not yet defined
case 8:
return Opcode.CLOSING;
case 9:
return Opcode.PING;
case 10:
return Opcode.PONG;
// 11-15 are not y... | 6 |
public ArrayList<UndoableItem> undoFunction() {
ArrayList<UndoableItem> toReturn = new ArrayList<>();
if (undoStack.isEmpty()) {
return null;
} else {
ArrayList<UndoableItem> cur = (ArrayList<UndoableItem>) this.undoStack.pop();
this.redoStack.push(cur);
... | 5 |
public ServiceContainer() {
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Action other = (Action) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... | 6 |
public int findPeakElement(int[] num){
int fore = -9999999, next=-9999999;
for(int i = 0; i < num.length; i++){
if(i+1 == num.length)
next = -999999;
else next = num[i+1];
if(num[i] >= fore && num[i] >= next)
return i;
}
return 0;
} | 4 |
@Override
public Point2D next() {
Point2D ret = new Point2D.Double(x, y);
double e2 = 2*error;
if (e2 > -dy) {
error -= dy;
x += sx;
}
if (e2 < dx) {
error += dx;
y += sy;
}
return ret;
} | 2 |
public static void startupHttpClient() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/HTTP", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mo... | 6 |
private boolean goalIsOnTheRoad(Goal goal) {
Direction cabinDirection = cabinDirection();
if (cabinDirection == Direction.DOWN) {
return cabin.getCurrentFloor() >= goal.getFloor() && goal.getFloor() >= nextFloorToReach() && Direction.DOWN == goal.getNextDirection();
}
return... | 5 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((affected instanceof MOB)
&&(((MOB)affected).isInCombat())
&&(!struckDownToday)
&&(CMLib.dice().roll(1,1000,0)==1)
&&(((MOB)affected).getWorshipCharID().length()>0)
&&(!((MOB)affected).getVi... | 8 |
@Override
public boolean contains(Object o){
if(o instanceof Set<?>){
Set<?> set = (Set<?>) o;
if(wrapped.containsAll(set)){
return true;
}
}
return false;
} | 5 |
private void drawDragRowInsertionMarker(Graphics gc, Row parent, int insertAtIndex) {
Rectangle bounds = getDragRowInsertionMarkerBounds(parent, insertAtIndex);
gc.setColor(Color.red);
gc.drawLine(bounds.x, bounds.y + bounds.height / 2, bounds.x + bounds.width, bounds.y + bounds.height / 2);
for (int i = 0; i <... | 1 |
protected void spots(int i, int j, BufferedImage completePic, int toSpread) {
// 10% chance to stop, 90% chance to keep going on each iteration
for (double rand = random.nextDouble(); rand < 0.9; rand = random
.nextDouble()) {
if (rand < 0.225) {
i--;
} else if (rand < 0.450) {
i++;
} else if (... | 6 |
public boolean isAABBInMaterial(AxisAlignedBB par1AxisAlignedBB, Material par2Material)
{
int var3 = MathHelper.floor_double(par1AxisAlignedBB.minX);
int var4 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
int var5 = MathHelper.floor_double(par1AxisAlignedBB.minY);
int var... | 7 |
public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} | 5 |
public static int stringToInt(String s) throws IllegalArgumentException {
/*
* (1) Determine if number should be negative (and starting index for
* processing the rest of the String.
*/
boolean isNegative = false;
if (s.length() > 1 && s.charAt(0) == '-') {
isNegative = true;
}
/*
* (2... | 6 |
@Override
public boolean push_msg (Msg msg_)
{
switch (state) {
case bottom:
if (msg_.flags () == Msg.more && msg_.size () == 0) {
state = State.body;
return super.push_msg (msg_);
}
break;
... | 8 |
public ClassInfo loadClass(final String name)
throws ClassNotFoundException {
final String classFileName = name.replace('.', '/') + ".class";
final InputStream is = BloatingClassLoader.this
.getResourceAsStream(classFileName);
if (is == null) {
throw new ClassNotFoundException("Could not find cla... | 1 |
public List findAll() {
log.debug("finding all Member instances");
try {
String queryString = "from Member";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
} | 1 |
public void testFormat_shortBasicParse() {
// Tests special two digit parse to make sure it properly switches
// between lenient and strict parsing.
DateTime dt = new DateTime(2004, 3, 9, 0, 0, 0, 0);
DateTimeFormatter f = DateTimeFormat.forPattern("yyMMdd");
assertEquals(dt, f... | 1 |
public static void llenarMemorizacion2() {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
int cuento = (matriz[i][j]=='.'? 1:0 );
if(i==0 && j==0)
memorizacion2[i][j] = cuento;
else if(i==0)
memorizacion2[i][j] = memorizacion2[i][j-1] + cuento;
else... | 7 |
public int getDepth()
{
return depth;
} | 0 |
public Meta(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "charset":
charset = Charset.parse(this, v);
break;
case "content":
content = Content.parse(this, v);
... | 6 |
public static int getPalindromeLength(String str) {
// 1.构造新的字符串
// 为了避免奇数回文和偶数回文的不同处理问题,在原字符串中插入'#',将所有回文变成奇数回文
StringBuilder newStr = new StringBuilder();
newStr.append('#');
for (int i = 0; i < str.length(); i++) {
newStr.append(str.charAt(i));
newStr.a... | 9 |
public static void berakning(int m, int n, int[] NtoY, int[] XtoM, int[][] vagar)
{
int min = vagar[0][0] + XtoM[0] + NtoY[0];
String Zon = "station 1 och station 1. Vilket är på avståndet: " + min + ".";
for(int i = 0; i < m; i++)
{
for(int i2 = 0; i2 < n; i2++)
{
int kortvag = vagar[i][i2] + XtoM[i... | 3 |
protected void setSourceDragColumn(TreeColumn column) {
if (mSourceDragColumn != null) {
repaintColumn(mSourceDragColumn);
}
mSourceDragColumn = column;
if (mSourceDragColumn != null) {
repaintColumn(mSourceDragColumn);
}
} | 2 |
public static void startupTimepointSupport() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/TIMEPOINT-SUPPORT", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Ste... | 7 |
public void run() {
/*if there is a message store and check it*/
if (bot.hasPrivateMessage()) {
message = bot.getPrivateMessage();
}
/*This method checks if the user has the proper access*/
if (checkAccess(2, bot.getPrivateSender()) == false) {
return;
... | 5 |
@EventHandler
public void SpiderWaterBreathing(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.getSpiderConfig().getDouble("Spider.... | 6 |
public static void writeALevel(String level) throws Exception
{
System.out.println(level);
BufferedReader reader = new BufferedReader(new FileReader(new File(ConfigReader.getMicrboesVsMetabolitesDir() + File.separator +
"toFodor05182015_PL_shucha_bothLanes_wTaxa.txt")));
List<String> sampleNames = new Ar... | 7 |
public void save (String filepath) throws IOException {
new ShrinkTail(tail,begs,lens).shrink();
int nodeSize = chck.size();
// 末尾の未使用部分を取り除く
for(; nodeSize > 0 && chck.get(nodeSize-1) == Node.Chck.VACANT_CODE; nodeSize--);
nodeSize += Node.Chck.CODE_LIMIT; // 検索時の範囲外アクセスを防ぐために、余白を設ける
final int total = 4*3 +... | 6 |
public static void main(String[] args) throws IOException {
input();
output();
} | 0 |
public Airplane() {
wSeats=new String[TOTAL_WIN_SEATS];
aSeats=new String[TOTAL_AISLE_SEATS];
for(int i=0;i<wSeats.length;i++) {
wSeats[i]=new String("NA");
}
for(int i=0;i<wSeats.length;i++) {
aSeats[i]=new String("NA");
}
} | 2 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((msg.source()==affected)
&&(msg.sourceMinor()== CMMsg.TYP_FACTIONCHANGE)
&&(msg.othersMessage()!=null)
&&(msg.othersMessage().equalsIgnoreCase(CMLib.factions().AlignID()))
&&(msg.value()>0)
&&(msg.value()<Integer.MAX_VALUE)... | 8 |
public void removeComponent(Class<? extends IComponent> clazz, Entity entity) {
registeredComponents.get(clazz).remove(entity);
} | 1 |
public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
return false;
} catch (UnsupportedAudioFileException e) {
return false;
} catch (LineUnavailableException... | 3 |
@EventHandler
public void ZombieBlindness(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.getZombieConfig().getDouble("Zombie.Blind... | 6 |
private void enterIdSuccAndCost(ArrayList<PlageHoraire> PlagesHoraires, LinkedList<Livraison> tabLivraison, Tournee ens) throws Exception
{
PlageHoraire PH1,PH2;
// Insert entrepot at the beginning
ArrayList<Integer> suivantEntrepot = new ArrayLis... | 9 |
private int countLivingNeighbors(int x, int y) {
int livingNeighbors = 0;
for (int xx = x - 1; xx < x + 2; xx++) {
for (int yy = y - 1; yy < y + 2; yy++) {
if (xx == x && yy == y)
continue;
if (isAlive(xx, yy)) {
livingNeighbors++;
}
}
}
return ... | 5 |
private static int getJobBy5ByteEncoding(int encoded) {
switch (encoded) {
case 2:
case 3:
return 100;
case 4:
return 200;
case 8:
return 300;
case 16:
return 400;
case 32:
case 63:
return 500;
default:
return 0;
}
} | 7 |
@Override
protected EntityManager getEntityManager() {
return em;
} | 0 |
public final Function<Random, TestMethod> nextMethod(Class<?> actualType) {
AliasedMethodTable<TestMethod> d = cache.get(requireNonNull(actualType));
return d != null ? d : cache.computeIfAbsent(actualType, new Function<Class<?>, AliasedMethodTable<TestMethod>>() {
public AliasedMethodTable<... | 8 |
private void heap_down() {
Binarynode node = root;
Binarynode help;
int valuehelper;
while (true) {
if (node.right == null || node.left.value > node.right.value) {
help = node.right;
} else {
help = node.left;
}
... | 5 |
public void testPropertySetHour() {
LocalTime test = new LocalTime(10, 20, 30, 40);
LocalTime copy = test.hourOfDay().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 12, 20, 30, 40);
try {
test.hourOfDay().setCopy(24);
fail();
} catc... | 2 |
public static int[] access(int[] a,int[] reg,int rw)
{
int[] r=new int[ARRAY_ROWS];
int[] b1=new int[WORD_SIZE];
//generate row selects (and-circuit)
for(int row=0;row<ARRAY_ROWS;row++)
{
int mask=4;
r[row]=Function.and(Function.C_MEMORY,(row&1)>0?a[0]:Function.not(Function.C_MEMORY,a[0]),(row... | 9 |
private static void optimizeMoves(List<DefinedMove> path) {
DefinedMove prevMove = null;
int count = 1;
for (ListIterator<DefinedMove> it = path.listIterator(); it.hasNext(); ) {
DefinedMove move = it.next();
/*
* Check if some move is repeated 3 times
*/
if (move.equals(prevMove))
count+... | 7 |
@Override
public List<String> onTabComplete(CommandSender sender, Command command,
String alias, String[] args) {
if (args.length == 1) {
List<String> matches = new ArrayList<String>();
for (String subcommand : subcommands) {
if (StringUtil.startsWithIgnor... | 6 |
public void move(int offsetX, int offsetY) {
CPRect srcRect;
offsetX += movePrevX;
offsetY += movePrevY;
if (moveInitSelect == null) {
srcRect = getSelectionAutoSelect();
if (!getSelection().isEmpty()) {
moveInitSelect = getSelection();
}
} else {
srcRect = (CPRect) moveInitSelect.clone();
... | 5 |
protected double generateAmplitude(double time, double amplitude){
double amp = amplitude;
if(time<adsr.getAttackTime()){
double deltaAmp=this.amplitude/(getSampleRate()*adsr.getAttackTime()); //the rate of growth of amplitude per sample
return amplitude+deltaAmp;
}
else if(ti... | 5 |
public void run() {
try {
oos = new ObjectOutputStream(connection.getOutputStream());
ois = new ObjectInputStream(connection.getInputStream());
}
catch (Exception e) {
e.printStackTrace();
return;
}
try {
BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
w... | 9 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public static void setSpeed(int s) {
if (s > MAX_SPEED || s < 1) {
Debug.printWarning("Trying to set speed greater than maximum ("
+ MAX_SPEED + ")! Setting to max instead...");
speed = MAX_SPEED;
return;
}
speed = s;
} | 2 |
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.