text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setProperty(Object value, String str) {
if(value instanceof String) {
if(str.equals(IP_STR)) {
setIp((String) value);
} else if(str.equals(NAME_STR)) {
setName((String) value);
} else if(str.equals(DESC_STR)) {
setDescription((String) value);
}
}
} | 4 |
@Override
public String toString() {
Node<T> currNode = head.getNext();
String info = null;
if (head == null) {
return " ";
} else {
info = head.getData().toString();
}
while (currNode != null) {
info = info + "\n" + currNode.getData().toString();
currNode = currNode.getNext();
}
return inf... | 2 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Applicant)) {
return false;
}
Applicant other = (Applicant) object;
if ((this.idapplicant == null && other.idap... | 5 |
public void setEmployee_id(String employee_id) {
this.employee_id = "thisishardcoded";
setDirty();
} | 0 |
static long visit(int A[], int n, int verbose, long count){
// If verbose mode = 3, print all the possible combinations
if (verbose == 3) {
for(int i = 1; i <= n; i++) {
if (A[i] != 0) System.out.print(i + " "); // print the chosen elements from 1...n
}
System.out.println();
}
// If v... | 5 |
@Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE)
PillarEntity.PILLAR_IMAGE.draw(x - 11.5f * scale, y - 22 * scale, 23 * scale, 32 * scale);
} | 1 |
@Override
public Connection openConnection() {
File file = new File(dbLocation);
if (!(file.exists())) {
try {
file.createNewFile();
} catch (IOException e) {
plugin.getLogger().log(Level.SEVERE, "Unable to create database!");
}
... | 4 |
public static void main(String[] args) throws Throwable {
ArrayList<Long> array = new ArrayList<Long>();
array.add(1l);
array.add(1l);
int i = 2 ;
long res;
do {
res = array.get(i-1)*i;
array.add(res);
i++;
}while(res <= 6227020800l);
BufferedReader in = new BufferedReader(new InputStreamRe... | 8 |
@Test
public void testAsteroidYAndVelocityYRandomness() {
ArrayList<Asteroid> ast = new ArrayList<Asteroid>();
for (int i = 0; i < 20; i++) {
p.spawnAsteroids();
}
for (Asteroid a : p.getAsteroids()) {
if (a.getVelY() > 0) {
ast.add(a);
... | 5 |
public void update(){
int xa =0, ya=0;
if(anim<8000){
anim++;
}else anim =0;
if(input.up)ya--;
if(input.down)ya++;
if(input.left)xa--;
if(input.right)xa++;
if(xa !=0 || ya !=0){
lastTime = System.currentTimeMillis();
move(xa,ya);
walking = true;
} else {
now = System.curr... | 8 |
private BoardNode[] findWordFrom(BoardNode start, String word){
//dfs like search to find a word from the start point
StackADT<BoardNode> searchStack=new ArrayStack<BoardNode>();
int depth=1;
boolean found=false;
BoardNode current=start;
BoardNode next;
//push the startpoint on the stack
searchStack.pu... | 6 |
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int msj_p, msj_c, num, num2, tmp1, tmp2, tmp3, tmp4, aux;
boolean continua;
do{
continua = false;
System.out.println("Ingrese el numero entero cifrado de 4 digitos: ");
msj_c = entrada.nextInt();
if(msj_c > 9999)
... | 8 |
private static ThreadTimingContext getThreadTimingContext(String threadName, String timingContext) {
for (ThreadTimingContext context : points.keySet()) {
if (context.getThreadName().equals(threadName)
&& (context.getTimingContext().equals(timingContext)))
return... | 3 |
private void showMessage(String typeMessage, String text, String title){
if(typeMessage.equals("error")){
JOptionPane.showMessageDialog(this, text, title,JOptionPane.ERROR_MESSAGE);
}
if(typeMessage.equals("info")){
JOptionPane.showMessageDialog(this, text, title,JOptionP... | 2 |
public void setFesTerminal(String fesTerminal) {
this.fesTerminal = fesTerminal;
} | 0 |
@POST()
@Path("add")
@Consumes("application/json")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player addPlayer(Player p)
{
UserTransaction utx = null;
p.setId(0);
try
{
System.out.... | 3 |
public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
} | 0 |
private void sendGamePackage() {
String version = isaacPackage.getVersion();
String seed = isaacPackage.getSeed();
String stage = isaacPackage.getStage();
String rooms = isaacPackage.getRooms();
String items = isaacPackage.getItems();
String curse = isaacPackage.getCurse();
String playerName = isaacPacka... | 6 |
protected String removeQuotesInsideTags(String html) {
//remove quotes from tag attributes
if(removeQuotes) {
Matcher matcher = tagQuotePattern.matcher(html);
StringBuffer sb = new StringBuffer();
while(matcher.find()) {
//if quoted attribute is followed by "/" add extra space
if(matcher.group(3).t... | 3 |
public void fireItemEvent(final ItemEvent EVENT) {
fireEvent(EVENT);
final EventType TYPE = EVENT.getEventType();
final EventHandler<ItemEvent> HANDLER;
if (ItemEvent.ITEM_CLICKED == TYPE) {
HANDLER = getOnItemClicked();
} else if (ItemEvent.ITEM_SELECTED == TYPE) {
... | 4 |
private boolean inBounds(int x1, int y1, int x2, int y2, int x, int y) {
if (x >= x1 && x <= x2 && y >= y1 && y <= y2) {
return true;
}
return false;
} | 4 |
public void run() {
while (s >= 0) {
ultimaEscritura(nombre);
if (s == 0)
{
cont--;
System.out.println(nombre + " - " + s + " - ultima escritura "
+ IDanterior);
System.out.println("ultima escritura " + nombre + " - " + cont
+ " Threads activos");
}
else {
System.o... | 3 |
public int calcFatorInc(Personagem personagem){
int valor = 0;
switch (personagem.getClasse()){
case 1:
valor = (int) (personagem.getQuantidadeVida() * 0.1);
break;
case 2:
valor = (int) (personagem.getQuantidadeVida() * 0.4);
... | 3 |
public String[] obtenerRespuestasCorrectas(int tamaño){
String csvFile = "dataset/diabetes_prueba_resultados.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String respuestas [] = new String [tamaño];
int contador = 0;
try {
br = new BufferedReader(new FileReader(csvFile))... | 6 |
public Ball(Point BallPosition) {
this.ballPosition = BallPosition;
int randomNumber = (int) Math.round(Math.random() * 10);
switch (randomNumber) {
case 1:
this.color = Color.YELLOW;
break;
case 2:
this.color = Color.BLUE;... | 8 |
public void setTransport(AIUnit transport) {
if (this.transport == transport) return;
AIUnit oldTransport = this.transport;
this.transport = transport;
if (oldTransport != null) {
// Remove from old carrier:
if (oldTransport.getMission() != null && oldTransport.g... | 8 |
public String read() {
//TODO For Debugging right now
this.i++;
switch( this.i ) {
case 0:
return "<LOGIN>`mjchao`12345`";
case 1:
return "<CREATE_ROOM>`Mickey's Room`1`60`10`4`false";
case 2:
return "<JOIN_ROOM>`0";
default:
return "ignore";
}
} | 3 |
private static void generateFile(String fileName) throws FileNotFoundException, IOException {
FileOutputStream fileOutputStream = new FileOutputStream(fileName);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF8"));
BufferedWriter bufferWriter... | 2 |
public static VorbisPacket create(OggPacket packet) {
// Special header types detection
if (isVorbisSpecial(packet)) {
byte type = packet.getData()[0];
switch(type) {
case TYPE_INFO:
return new VorbisInfo(packet);
case TYPE_COMMENTS:
... | 4 |
public Object get(Object target) {
if (staticBase != null)
target = staticBase;
if (type == int.class)
return unsafe.getInt(target, offset);
else if (type == long.class)
return unsafe.getLong(target, offset);
else if (type == short.class)
return unsafe.getShort(target, offset);
else if (type == b... | 9 |
static private float[] create_t_43()
{
float[] t43 = new float[8192];
final double d43 = (4.0/3.0);
for (int i=0; i<8192; i++)
{
t43[i] = (float)Math.pow(i, d43);
}
return t43;
} | 1 |
void generateRandomNet(BayesNet bayesNet, Instances instances) {
int nNodes = instances.numAttributes();
// clear network
for (int iNode = 0; iNode < nNodes; iNode++) {
ParentSet parentSet = bayesNet.getParentSet(iNode);
while (parentSet.getNrOfParents() > 0) {
parentSet.deleteLastParent(instances);
... | 8 |
public static void showAccountList(){
String lines = "-All accounts in the system: ";
//Money totalMoney = new Money();
int sizeOfList = accounts.size();
for(int index = 0; index < sizeOfList; index++){
if(index%3 == 0){
lines += "\n" + accounts.get(index);
}
else{
lines += "\t" + accounts.get(... | 2 |
public void stop()
{
numSteps = 0;
threadRun = false;
infinite = false;
} | 0 |
public static void writeToFile(File file, RunData runData)
{
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
XMLOutputFactory xmlOutFact = XMLOutputFactory.newInstance();
XMLStreamWriter writer = xmlOutFact.createXMLStreamWriter(fos);
writer.writeStart... | 3 |
@Override
public mxICell insertEdge(mxICell edge, boolean isOutgoing)
{
if (edge != null)
{
edge.removeFromTerminal(isOutgoing);
edge.setTerminal(this, isOutgoing);
if (edges == null || edge.getTerminal(!isOutgoing) != this
|| !edges.contains(edge))
{
if (edges == null)
{
edges = ne... | 5 |
public LocalizationClient(String ip, int port) throws IOException, ConnectException {
try {
clientSocket = new SocketManager(ip, port);
clientSocket.setSoTimeout(5000);
} catch (ConnectException e) {
throw new ConnectException();
}catch (IOException e) {
throw new IOException();
}
} | 2 |
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String outputJson = "";
PrintWriter out = response.getWriter();
try {
String method = request.getParameter("method").toLowerCase(
Locale.ENGLISH);
... | 7 |
public final void modifySanity(int toMod)
{
sanity+=toMod;
if(sanity > 100)
{
sanity = 100;
}
else if(sanity < 0)
{
sanity = 0; //oh shiet
}
} | 2 |
@Override
public RedBlackTree.Node<T> insert(T value) {
RedBlackTree.Node<T> result = super.insert(value);
if (result != null) {
Node<T> linkedNode = (Node<T>) result;
Node<T> pred = (Node<T>) super.getPredecessor(result);
linkedNode.setPredecessor(pred);
if (pred != null) {
p... | 5 |
private void setStyle(MindMapNode node) {
// precondition: all children are contained in nodeIconSets
// gather all icons of my children and of me here:
TreeSet iconSet = new TreeSet();
for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
MindMapNode child = (MindMapN... | 7 |
public static CommandMessage getCommandMessage(Command command,
int sequenceNumber, String serialNumber) {
switch (command.getCommandType()) {
case SHELL_COMMAND: {
return new ControlRunShellCommandMessage(sequenceNumber,
serialNumber, command.getSubType(), command.getParams());
}
case FILE_HANDLING... | 4 |
@Override
public void run() {
timer.scheduleAtFixedRate(new Timing(this), 1000, 100);
} | 0 |
public static void main(String[] args) {
//Init connection count
for(int i =0; i< 100; i++){
(new Thread(new TestClass())).start();
}
} | 1 |
public static void printMethod(Method m)
{
String name = m.getName();
System.out.print(Modifier.toString(m.getModifiers()));
System.out.print(" ");
printTypes(m.getTypeParameters(), "<", ", ", "> ", true);
printType(m.getGenericReturnType(), false);
System.out.print(" ");
S... | 0 |
private void countVectorsModulo() {
for (wordsDocument doc : webDocs) {
doc.powVectors = new double[dictionarySize];
for (int i = 0; i < doc.powVectors.length; i++)
doc.powVectors[i] = Math.pow(doc.vectors[i], 2);
double allNumbers = 0;
for (int i = 0; i < doc.powVectors.length; i++)... | 3 |
void onFocusIn () {
hasFocus = true;
if (itemsCount == 0) {
redraw ();
return;
}
if ((getStyle () & (SWT.HIDE_SELECTION | SWT.MULTI)) == (SWT.HIDE_SELECTION | SWT.MULTI)) {
for (int i = 0; i < selectedItems.length; i++) {
redrawItem (selectedItems [i].index, true);
}
}
if (focusItem != null) {
redraw... | 5 |
public void setNameLangKey(String nameLangKey) {
this.nameLangKey = nameLangKey;
} | 0 |
private void cmdTURN(final ArrayList<String> args) {
if (status == INGAME) {
if (args.size() == 1) {
if (!game.getTurnSet()) {
if (game.getPlayerCount() != 2) {
game.setTurn(game.getPlayer(args.get(0)).getColor());
} else {
game.setTurn(game.getPlayer(args.get(0)).getColor() / 2);
}
... | 5 |
private int Number(Point point, Point point2, Point[] points) {
int count =0;
for(int i=0; i<points.length ;i++){
if((point2.x- point.x)*(points[i].y-point.y) ==
(points[i].x- point.x)*(point2.y-point.y)){
count++;
}
}
return count;
... | 2 |
protected int getVerticesIndexFor( Vertex<T> v ) {
if ( v == null ) {
throw new IllegalArgumentException( "null vertex" );
}
for ( int i = 0; i < vertices.length; i++ ) {
if ( vertices[i] != null && vertices[i].equals( v ) ) {
return i;
}
}
return -1;
} | 4 |
public static void startTag(StringWriter xml, String tag,
Hashtable attributes)
{
xml.write("<" + tag);
if (attributes != null)
{
Enumeration keys = attributes.keys();
while (keys.hasMoreElements())
{
String key = keys.nextElement().toString();
String value = (String) attributes.get(key);
... | 2 |
int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
continue;
}
if (s1.charAt(i) == s2.charAt(j)) {
b++;
}
}
... | 4 |
@Test
public void testParseUserAgentString() {
testAgents(ie55clients, Browser.IE5_5);
testAgents(ie6clients, Browser.IE6);
testAgents(ie7clients, Browser.IE7);
testAgents(ie8clients, Browser.IE8);
testAgents(ie9clients, Browser.IE9);
testAgents(ie10clients, Browser.IE10);
testAgents(ie11clients, Browser... | 0 |
public void craftRunes(int altarID) {
int runeID = 0;
for (int i = 0; i < this.altarID.length; i++) {
if (altarID == this.altarID[i]) {
runeID = runes[i];
}
}
for (int i = 0; i < craftLevelReq.length; i++) {
if (runeID == runes[i]) {
... | 9 |
@Override public boolean equals(Object obj){
return (expression == ((Expression)obj).expression);
} | 0 |
public String execute(String[] args){
return runList.remove(Long.parseLong(args[0])).toString() + "\n---removed from queue.";
} | 0 |
* @throws IOException if a communications error occurs
* @throws UnknownHostException if the Cyc server cannot be found
* @throws CycApiException if the Cyc server returns an error
*/
public void unassertMtContentsWithoutTranscript(CycObject mt)
throws UnknownHostException, IOException,
C... | 1 |
@Override
public int compareTo(Point p) {
if (y == p.y) {
return x < p.x ? -1 : x == p.x ? 0 : 1;
}
return y < p.y ? -1 : y == p.y ? 0 : 1;
} | 5 |
public void setXYwrap(boolean xwr, boolean ywr){xwrap = xwr; ywrap = ywr;
int xpol; if(xwr){xpol = 1;}else{xpol = 0;}
int ypol; if(ywr){ypol = 1;}else{ypol = 0;}
borpol[2] = xpol; borpol[6] = xpol;
borpol[0] = ypol; borpol[4] = ypol;
if(xwr && ywr){borpol[1] = 1; borpol[3] = 1; borpol[5] = 1; ... | 5 |
@Override
protected void setProperty(ConfigCommand cmd) {
int argc = cmd.argc ;
Object[] argv = cmd.argv ;
if (argc < 4) {
syntaxError("Wrong number of arguments to " + cmd.commandName) ;
}
if (! isName(argv[2])) {
syntaxError("The second argument to " + cmd.commandName +
" must be a property n... | 8 |
public void loadTypes() {
this.types = new HashMap<String, Type>();
Integer i = 0;
if(plugin.configData.config.isConfigurationSection("types")) {
Set<String> types = plugin.configData.config.getConfigurationSection("types").getKeys(false);
if(!types.isEmpty()) {
for(String name : types) {
loa... | 3 |
public void update(GameContainer gc, int delta) throws SlickException {
quadtree.clear();
for (Shape shape : collisionObjects)
quadtree.insert(shape);
player.update(gc, delta);
viewport.update(player);
List<Shape> collidableShapes = Lists.newArrayList();
for (int i = 0; i < collisionObjects.size(); i++... | 5 |
public ArrayList<String> getPositionOfPosDestSquares(Piece piece, int x, int y, Piece[][] board, boolean owner){
ArrayList<String> moves = new ArrayList<String>();
if(piece instanceof Pawn){
Pawn pawn = (Pawn) piece;
moves = pawn.getPossibleMoveDestinations(x, y, board, owner);
moves.addAll(pawn.getPoss... | 6 |
@Override
public void executeMsg(Environmental myHost, CMMsg msg)
{
super.executeMsg(myHost, msg);
if(msg.amITarget(this))
{
switch(msg.targetMinor())
{
case CMMsg.TYP_ACTIVATE:
{
final LanguageLibrary lang=CMLib.lang();
final String[] parts=msg.targetMessage().split(" ");
final TechComm... | 8 |
public int addTableSwitch(int low, int high)
{
if (DEBUGCODE) {
System.out.println("Add "+bytecodeStr(ByteCode.TABLESWITCH)
+" "+low+" "+high);
}
if (low > high)
throw new IllegalArgumentException("Bad bounds: "+low+' '+ high);
... | 7 |
public IAIGraph createGraph() {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(this.src));
// Files are not encoded so you have to do it manually
String line1 = UTF8EncodedString(br.readLine());
this.direction = getDirection(line1);
initGraph();
String line = UTF8Encoded... | 6 |
@Override
public void doNewGame()
{
SettingsDialog.getInstance().showDialog();
} | 0 |
protected Component findComponentAt(Container container, int x, int y) {
Rectangle bounds = new Rectangle();
int count = container.getComponentCount();
//ShapePainterStrategy shapePainterStrategy = getShapePainter(container, null);
for(int i = 0; i < count; i++) {
Component child = container.getComponent(i... | 7 |
public static String base64encode(byte[] buf) {
int size = buf.length;
char[] ar = new char[((size + 2) / 3) * 4];
int a = 0;
int i = 0;
while (i < size) {
byte b0 = buf[i++];
byte b1 = (i < size) ? buf[i++] : 0;
byte b2 = (i < size) ? buf[i++]... | 5 |
private int endY( Side side ){
if( side == Side.NORTH ){
return boundaries.y;
}
else{
return boundaries.y + boundaries.height;
}
} | 1 |
public double[] convolve_rows_gauss(double[] image, double[] mask)
{
long j, r, c, l;
double sum;
double [] h;
int n;
h = new double[(int) (width*height)];
n=(int) ((mask.length-1)*0.5);
/* Inner region */
for (r=n; r<height-n; r++) {
for (c=0; c<width; c++) {
l ... | 9 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnExcluir) {
do_btnExcluir_actionPerformed(e);
}
if (e.getSource() == btnEntrar) {
do_btnEntrar_actionPerformed(e);
}
if (e.getSource() == btnNovo) {
do_btnNovo_actionPerformed(e);
}
} | 3 |
@EventHandler
public void onSignChange(final SignChangeEvent event)
{
if (event.getLine(0) != null)
{
if ("<-pCops->".equals(event.getLine(0)) && !event.getPlayer().hasPermission("pcops.signpost"))
{
event.getBlock().breakNaturally();
}
}
} | 3 |
public String Tclient(int num) throws SocketException, IOException, InterruptedException{
TelnetService TC=TNH.get(num);
TNH.get(num).mynum=num;
String rtn=TC.getTelnetSessionAsString(Integer.toString(num));
if (rtn.equals("reload")){return rtn;}
TC.readit(" ","Room error");
dw.append("Server "+num+": ");
... | 3 |
boolean handleMousePressed(int x, int y) {
if (selectedComponent instanceof LineComponent) {
LineComponent lc = (LineComponent) selectedComponent;
int i = lc.nearEndPoint(x, y);
lc.setSelectedEndPoint(i);
lc.storeCurrentState();
return i > 0;
} else if (selectedComponent instanceof RectangleComponent... | 7 |
int syncHeader(byte syncmode) throws IOException {
if((bytesread = source.read(syncbuf,0,3))!= 3)
return -1;
// return 0;
headerstring = syncbuf[0] << 16 & 0xff0000 | syncbuf[1] << 8 & 0xff00 | syncbuf[2] << 0 & 0xff;
if(first_call){
id_v2 [0] = ... | 6 |
final boolean method321(int i, int i_14_, int i_15_, int i_16_) {
anInt411++;
if (anInt418 > i_16_ || (anInt419 ^ 0xffffffff) > (i_16_ ^ 0xffffffff))
return false;
if ((i_15_ ^ 0xffffffff) > (anInt416 ^ 0xffffffff) || i_15_ > anInt406)
return false;
if (i_14_ < anInt412 || (i_14_ ^ 0xffffffff) < (anInt404... | 8 |
private static Move ForwardRightCaptureForBlack(int r, int c, Board board){
Move forwardRightCapture = null;
if(r>=2 && c>=2 && (
board.cell[r-1][c-1].equals(CellEntry.white)
|| board.cell[r-1][c-1].equals(CellEntry.whiteKing)
)
... | 5 |
protected void updateBlackHole() {
blackHole.extendDuration(1);
if (blackHole.isExpired()) {
isBlackHole = false;
blackHole.reset();
}
} | 1 |
public void goalKick( ArrayList<Player> players, Player p){
if (((Player)p).isGoalie()){
try{
p.setBall(ball);
int num = GameEngine.rgen.nextInt(11);
if(players.get(num) != p){
p.pass(players.get(num));
} else {
if(num < 10){
num ++;
} else {
num--;
}
p.pass(p... | 6 |
protected int computeScore () throws IncompatibleScoringSchemeException
{
int[] array;
int rows = seq1.length()+1, cols = seq2.length()+1;
int r, c, tmp, ins, del, sub, max_score;
// keep track of the maximum score
max_score = 0;
if (rows <= cols)
{
// goes columnwise
array = new int [rows];
... | 9 |
public static void captureScreenshot() {
Calendar cal = new GregorianCalendar();
int month = cal.get(Calendar.MONTH); //4
int year = cal.get(Calendar.YEAR); //2013
int sec =cal.get(Calendar.SECOND);
int min =cal.get(Calendar.MINUTE);
int date = cal.get(Calendar.DATE);
int day =cal.... | 1 |
@Override
public void mouseClicked(MouseEvent paramMouseEvent) {/**/} | 0 |
@Override
public SkillsMain[] getSkillNames() {
return Constants.assassinSkillSkills;
} | 0 |
public void writeTable(Map table, boolean reversed) {
if (!isReachable() && (Main.stripping & Main.STRIP_UNREACH) != 0)
return;
if (getAlias().length() != 0) {
String name = getName();
Identifier outer = getParent();
while (outer != null && outer.getAlias().length() == 0) {
if (outer.getName().leng... | 8 |
public static void main(String args[]){
AudioInputStream ain;
try {
ain = AudioSystem.getAudioInputStream(new File("C:\\Users\\Andy2\\javawork\\workspace\\Learning Java\\src\\empous\\resources\\audio\\sample.wav"));
DataLine.Info info =
new DataLine.Info(Clip.class,ain.get... | 3 |
protected void updateEntityActionState()
{
++this.entityAge;
this.despawnEntity();
this.moveStrafing = 0.0F;
this.moveForward = 0.0F;
float var1 = 8.0F;
if (this.rand.nextFloat() < 0.02F)
{
EntityPlayer var2 = this.worldObj.getClosestPlayerToEntit... | 9 |
private void loadWords() throws IOException {
File f = new File(wordsPath);
FileInputStream fis = new FileInputStream(f);
InputStreamReader in = new InputStreamReader(fis, "utf-8");
BufferedReader br = new BufferedReader(in);
String l = null;
int wordCount = 0;
while ((l = br.readLine()) != null) {
// ... | 6 |
static void process() {
int i, j;
// we initialize every element in P with -1
for (i = 0; i < nodes; i++)
for (j = 0; 1 << j < nodes; j++) {
P[i][j] = -1;
D[i][j] = 0;
}
// the first ancestor of every node i is T[i]
for (i = 0; i < nodes; i++) {
P[i][0] = T[i];
D[i][0] = W[i];
}
// bot... | 6 |
private boolean checkPlaceFiel() {
if (currentStadiumIndex < 0) {
ModalDialog.showEror(frame, "Выберите стадион!");
return false;
}
if (sectorField.getText().trim().isEmpty() || placeField.getText().trim().isEmpty()) {
ModalDialog.showEror(frame, "Сектор и м... | 4 |
private void vistDFS(XmlNode node)
{
node.level = node.getLevel();
node.path = node.getPath();
if (node.nodetype == XmlNodeType.NODE)
{
if (node.getAttribute("type").equals(XmlScript.NODE_TYPE_NET))
this.addNet(node);
else if (node.getAttribute("type").equals(XmlScript.NODE_TYPE_ROUTER))
this.... | 5 |
public boolean addChild(Row row) {
if (canHaveChildren()) {
row.removeFromParent();
mChildren.add(row);
row.mParent = this;
return true;
}
return false;
} | 1 |
@Override
public Integer getIdFromDataBase() throws SQLException{
Connection connection = ua.edu.odeku.pet.database.ConnectionDataBase.getConnection();
Statement statement = connection.createStatement();
if(nameDepartment == null || nameDepartment.isEmpty()){
return null;
... | 5 |
private static String convertToSaveableString(String string[][]){
String temp="";
for (int a=0; a < string.length; a++ ){
for (int b=0; b < 2; b++ ){
if (b==0){
temp += string[a][b]+DATA_DIVIDER1;
} else {
temp += string[a][b]+DATA_DIVIDER2;
}
}
}
return temp;
} | 3 |
public int read(int address) {
if (this.cache.contains(address)) {
return this.cache.read(address);
} else {
for (int i = 0; i < this.history.length; i++) {
if (this.history[i] == address) {
// conflict miss
int mode = Integer.valueOf(this.cache.getMode(), 2);
if (mode < 8)
mode += 4;... | 7 |
boolean writeBytes(Frame frame) {
synchronized (this) {
if (m_handshaked == false ||
m_destroying == true) {
return false;
}
}
int n = -1;
ByteBuffer data = frame.getData();
int size = data.capacity();
int offset =... | 5 |
private boolean evaluateAddClause(String str) {
Matcher matcher = ATOM.matcher(str);
if (matcher.find()) {
str = str.substring(matcher.end()).trim();
Point3f p = new Point3f();
String s1 = null;
int space = str.indexOf(" ");
if (space < 0) {
s1 = str.substring(0).trim();
p.x = (float) (Math.r... | 9 |
private void cifrarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cifrarBActionPerformed
String log = "";
String c;
String m = plaintextTF.getText();
System.out.println("m: "+m);
log += "\n Message to cipher: "+m;
ArrayList<Integer> c_ascii = new Arra... | 3 |
private StdFileDialog(String... extension) {
for (String one : extension) {
mFileNameMatchers.add(createExtensionMatcher(one));
}
} | 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.