text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void addTargetControlsToPanel(JPanel panel, final IntValueHolder targetTypeValueSource, final IntValueHolder targetNumberValueSource)
{
Integer validTargetTypes[] = Event_3_46.getTargetTypes();
Integer targetTypes[] = new Integer[validTargetTypes.length + 1];
targetTypes[0] = new Int... | 6 |
public boolean hasRelWithSubsection(int question_ID) {
boolean hasRel=false;
try {
StringBuffer sql = new StringBuffer();
sql.append("select Subsection_ID ");
sql.append("from subsectionquestion_ID ");
sql.append("where Question_ID=" + question_ID);
... | 2 |
public String toString() {
StringBuffer sb = new StringBuffer();
// balanced or ordinary OSDL
if (m_balanced) {
sb.append("Balanced OSDL\n=============\n\n");
} else {
sb.append("Ordinary OSDL\n=============\n\n");
}
if (m_weighted) {
sb.append("Weighted variant\n");
}
... | 8 |
public String getValue(String key) {
if(containsKey(key)) {
return getKeyValuePair(key).getValue();
} else {
return null;
}
} | 1 |
private void transmitText(String text) {
if (byteJRadioButton.isSelected()) {
boolean ready = false;
Scanner scanner = new Scanner(text);
while (! ready) {
try {
outputStream.write(scanner.nextInt());
}
catch... | 5 |
public double mean_as_double() {
double mean = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
for (int i = 0; i < length; i++) {
mean += dd[i];
}
mean /= length;
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
BigDecimal meanbd = BigDecimal.ZERO;... | 5 |
private boolean whiteCanEnPassantLeft( int position ) {
return ( this.previousMove != null && pieceTypeAt( position - 1 ) == PAWN && this.previousMove.from() == ( position + 31 ) ) && this.previousMove.to() == ( position - 1 );
} | 3 |
private static void enchantedBag() {
System.out.println("enchantedBag");
for (int i = 0; i < enchantedBag.length; ++i) {
if (enchantedBag[i] != null) {
System.out.println(i + ":" + enchantedBag[i]);
}
}
} | 2 |
private boolean isRed(Node node) {
if (node == null)
return false;
return node.color == RED;
} | 1 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,null,givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!target.subjectToWearAndTear())
{ mob.tell(L("@x1 cannot be reinforced.",targe... | 8 |
@Override
public boolean logoutClient(final String name) throws RemoteException
{
ServerManager.invokeLater(new Runnable()
{
@Override
public void run()
{
_connectedClients.remove(name);
_spiel.meldeSpielerAb(name);
if(name.equals(_hostName))
{
for(ClientInterface client : _connec... | 3 |
public void build() {
FileConfiguration fc = new YamlConfiguration();
File f = new File(plugin.getDataFolder(), "custom.yml");
if (f.exists()) {
try {
fc.load(f);
} catch (Exception e) {
if (plugin.getDebug())
plugin.log.warning(e.getMessage());
}
}
for (String name : fc.getKeys(false)) ... | 8 |
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] aint = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint1 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4);
int[] aint2 = IntCache.getIntCache(par3 * par4);
... | 7 |
static double[] spawnAveragesArrayFromPricePair(String ticker,
int neighborsToCount) {
double[] priceData = spawnTimeSeriesForFFT(ticker);
double[] avgPriceData = new double[priceData.length];
for (int J = neighborsToCount; J < (priceData.length - neighborsToCount); J++) {
float sum = 0;
int n = 0;
f... | 3 |
public void drawEntitiesOnMap(Renderer r) {
Graphics g = r.getGraphics();
for (EntityXML e : entities) {
if (e.getPos().x >= mapDisplayStart.x && e.getPos().x < mapDisplayStart.x + MAP_DISPLAY_NB_TILE_X
&& e.getPos().y >= mapDisplayStart.y && e.getPos().y < mapDisplayStart.y + MAP_DISPLAY_NB_TILE_Y) {
... | 5 |
public static void dump(File f) throws IOException {
try (BTXParser p = new BTXParser(f)) {
String indent = "";
l:
while (true) {
switch (p.next()) {
case ATTRIBUTE : {
BTXAttribute at = p.getEventData().getAttribute();
byte[] buf = new byte[at.getLength()];
at.fill(buf);
Sys... | 5 |
public final int getInt(int index) throws JSONException {
Object o = get(index);
return o instanceof Number ?
((Number)o).intValue() : (int)getDouble(index);
} | 1 |
@Override
public void run() {
if(Thread.currentThread().getId() % 2 == 0)
init("Achtung Die Kurve");
else
init("TicTacToe");
} | 1 |
public static String getSeptaServiceID() {
String servid = null;
String strDateFormat = "EEEE";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
sdf.setTimeZone(TimeZone.getTimeZone("America/New_York"));
String weekday = sdf.format(date);
Format formatter;
String s;
// TODO check cal date for... | 9 |
public void random(){
if(leafNode != null){
this.randomNumber = (int)(Math.random()*RANDOM_SINCOS);
}else{
this.randomNumber = (int)(Math.random()*RANDOM_XY+RANDOM_SINCOS);
}
if(this.randomNumber == 0){
this.textFunction = "sin(PI*x*";
}else if(this.randomNumber ==1){
this.... | 5 |
private void bootToRecoveryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bootToRecoveryButtonActionPerformed
try {
device.reboot(DeviceState.RECOVERY);
adbController.executeADBCommand(false, false, device, new String[]{"wait-for-device"});
} catch (IOEx... | 1 |
public Point[] getCorners() {
Point[] corners = new Point[4];
switch(orientation) {
case X_AXIS:
corners[0] = center.add(new Point(0, 0.5f, 0.5f, 1));
corners[1] = center.add(new Point(0, 0.5f, -0.5f, 1));
corners[2] = center.add(new Point(0, -0.5f, -0.5f, 1));
corners[3] = center.add(new Point(0... | 3 |
static public boolean hasImageFileExtension(File cl_f) {
String lstr_ext = getFileExtension(cl_f);
lstr_ext = lstr_ext.toLowerCase();
if (lstr_ext.equals("jpg") || lstr_ext.equals("jpeg") || lstr_ext.equals("png") || lstr_ext.equals("bmp") || lstr_ext.equals("tga") || lstr_ext.equals("gif")) {
return true;
... | 6 |
public void loadPlayers() throws BadConfigFormatException {
//This needs way way way more error checking
try {
FileReader reader = new FileReader("people.txt");
Scanner in = new Scanner(reader);
// set a marker that is true only for the first line
boolean marker = true;
// loop through all the lines
... | 3 |
public void registerValueVisitor(Class<?> targetClass, ValueVisitor visitor) {
if (visitors == null) {
visitors = new HashMap<Class<?>, ValueVisitor>(4);
}
visitors.put(targetClass, visitor);
} | 3 |
@Override
protected void processFocusEvent(FocusEvent event) {
super.processFocusEvent(event);
if (event.getID() == FocusEvent.FOCUS_GAINED) {
selectAll();
}
} | 1 |
public AnimatedSprite getAnimatedSprite(String imageURL, int rows, int columns) {
/*Get the animated sprite (load it if nescessary)*/
AnimatedSprite sprite = sprites.get(imageURL);
if(sprite == null) {
BufferedImage image = getTransparentImage(imageURL);
if(image == null) {
System.err.println("Breakout:... | 5 |
private void jCheckBoxQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxQuitActionPerformed
//Récupération de la méthode contrôleur 'close'
this.getCtrlM().close();
}//GEN-LAST:event_jCheckBoxQuitActionPerformed | 0 |
public Date ceil(Date date, int field) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
for (int currentField : fields) {
if (currentField > field) {
if (currentField == Calendar.DAY_OF_MONTH
&& (field == Calendar.WEEK_OF_MONTH || field == Calendar.WEEK_OF_YEAR)) {
continue;
}
... | 8 |
public static void main(String[] args){
Date now = new Date();
LinkedList<Room> rooms = new LinkedList<Room>();
rooms.add(new Room("chilloutRoom",Property.Dim,Property.Private,Property.Sitting));
rooms.add(new Room("officeRoom",Property.Bright,Property.Public,Property.Sitting));
Constraint c = new Constraint(... | 3 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
//cargo Parametros del Reporte
generarTabla();
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_social()... | 6 |
public ImageConfig getCurrentConfig(SurfaceSelection selection) {
Node ancestor = selection.getSelection().getRange().getCommonAncestorContainer();
if (ancestor != null && ancestor.getNodeType() == Node.ELEMENT_NODE) {
ImageElement img = (ImageElement) DOMUtil.getFirstChildOfType((Element) ancestor, "img"... | 8 |
private static String convertParameter(Object parameter) {
if (QueryBuilder.isBsonPrimitives(parameter.getClass())) {
return convertWithDriver(parameter);
}
String message = "无法将非BSON基本类型(non-bson-primitive)参数[" + parameter + "]绑定到查询json字符串中";
throw new IllegalMongoShellException(message);
} | 1 |
public Exon queryExon(Marker interval) {
for (Exon ei : this)
if (ei.intersects(interval)) return ei;
return null;
} | 2 |
private synchronized void insert(Packet np, double time)
{
if ( timeList.isEmpty() )
{
timeList.add( new Double(time) );
pktList.add(np);
return;
}
for (int i = 0; i < timeList.size(); i++)
{
double next = ( (Double) timeList.... | 3 |
public void crossing(ArrayList<Solve> population) {
ArrayList<Integer> tmp = new ArrayList();
Random rand = new Random();
int ind1, ind2;
for (int i = 0; i < populationsize; i++) {
tmp.add(i);
}
int k = populationsize;
while (k >= 2) {
ind1... | 3 |
@SuppressWarnings("unchecked")
public <T extends Object> T createProxyWithType(Class<T> Interface, InvocationHandler handler, Class<?> TYPE){
if(Interface.isInterface() == false || TYPE.isInterface() == false) throw new RuntimeException("Class is not an Interface");
ClassLoader sysLoader = ClassLoader.getSystemCla... | 4 |
private void jump(int S) {
jumps.clear();
jumps.push(S);
while (!jumps.isEmpty()) {
if (getWinner() != null) {
return;
}
int nxt = jumps.pop();
if (getSquare(nxt).spots() > neighbors(nxt)) {
getSquare(nxt).setSpots(g... | 9 |
public LevelOneQueue(Integer maxSize) {
queue = new PriorityQueue<Aircraft>(100, new Comparator<Aircraft>() {
@Override
public int compare(Aircraft x, Aircraft y)
{
if( x == null || y == null ) {
throw new IllegalArgumentException("");
}
//Default to having max f... | 8 |
private ConcurrentLinkedDeque<String>
merge(ConcurrentLinkedDeque<String> left, ConcurrentLinkedDeque<String> right) {
ConcurrentLinkedDeque<String> result = new ConcurrentLinkedDeque<String>();
while (left.size() > 0 || right.size() > 0) {
if (left.size() > 0 && right.size() > 0) {
if (left.pee... | 7 |
private int compileShader(String source, int type) {
int shader = glCreateShader(type);
glShaderSource(shader, source);
glCompileShader(shader);
String infoLog = glGetShaderInfoLog(shader, glGetShader(shader, GL_INFO_LOG_L... | 3 |
void begin() {
while(true){
if(toDo.isEmpty() == true){
toDo.addAll(done);
toDo.add(new DefaultState(as));
done.clear();
}
if(toDo.peek() == null){
toDo.remove();
}
else{
toDo.peek().show();
try{
done.add(toDo.poll().next());
}
catch(Exception e){
}
}
}
} | 4 |
public StructuredBlock appendBlock(StructuredBlock block) {
if (block instanceof EmptyBlock) {
moveJump(block.jump);
return this;
} else {
SequentialBlock sequBlock = new SequentialBlock();
sequBlock.replace(this);
sequBlock.setFirst(this);
sequBlock.setSecond(block);
return sequBlock;
}
} | 1 |
private void showDir(){
String dirPath = tf.getText();
File dir = new File(dirPath);
if(dir.exists() && dir.isDirectory()){
tf.setText("");
String[] names = dir.list();
for(String name:names){
ta.append(name+"\r\n");
}
}else{
String info = "Ya directory "+"\'"+dirPath+"\'"+" is wrong";
lab... | 3 |
public Map<String, List<String>> askQuery(String property, String target, String... otherProperties) throws IOException {
// Build the query (relying on the SMWAskAPI extension to be installed
StringBuilder prop = new StringBuilder("[["+property+"::"+target+"]]");
StringBuilder url = new StringBuilder(qu... | 8 |
public static String toJSONString(final String value)
{
final StringBuilder strBldr = new StringBuilder("");
for(final char c : value.toCharArray())
{
switch (c)
{
case '\"':
case '\\':
case '/':
strBldr.append('\\').append(c);
break;
case '\b':
strBldr.append('\\').append('b');
... | 9 |
private static boolean isLocationInScreenBounds(Point location) {
GraphicsDevice[] graphicsDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
for (int j = 0; j < graphicsDevices.length; j++) {
if (graphicsDevices[j].getDefaultConfiguration().getBounds().contains(location)) {
... | 2 |
public void editArena() {
if (this.arenastate == ArenaState.STAT_READY
|| this.arenastate == ArenaState.STAT_STARTED)
this.endGame(EndReason.END_REASON_ARENAEDIT);
else if (this.arenastate == ArenaState.STAT_OPEN) {
for (Player p : players) {
this.removeplayer(p);
p.sendMessage(ChatColor.RED + "༭ģ... | 4 |
public boolean equals(BoundingBox other)
{
if (min_x == other.minX() && min_y == other.minY() && max_x == other.maxX() && max_y == other.maxY())
{
return true;
}
else
{
return false;
}
} | 4 |
public static void checkChatYAML() {
File file = new File(path + "Chat.yml");
if(!file.exists()){
try{
file.createNewFile();
FileConfiguration f = YamlConfiguration.loadConfiguration(file);
f.set("Format", "&f+channel &7[+world&7]&f +name&7:&f +message");
f.set("World.defaultPrefix", "&4&lX");
... | 2 |
@Override
public void update(Task task) {
try {
connection = getConnection();
ptmt = connection.prepareStatement("UPDATE Task SET description=? title=? id_executor=?"
+ " active=? done=? WHERE idtask=?;");
ptmt.setString(1, task.getDescription());
... | 5 |
public int[] merger(int[] a , int[] b){
int curA=0,curB=0,curResult=0;
int[] result=new int[a.length+b.length];
while (curA<a.length && curB<b.length){
if(a[curA]>b[curB]){
result[curResult++]=a[curA++];
}else if(a[curA]<b[curB]){
result[cu... | 9 |
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null || object.getClass() != getClass()) {
return false;
}
Slope other = (Slope) object;
if (isVertical() && other.isVertical()) {
return true;... | 7 |
public static void main(String[] args) {
int searchForEach = 10;
int warmup = 100000;
int count = 1000000;
int length = UUID.randomUUID().toString().getBytes().length;
System.out.println("length: " + length);
// prepare warmup data
System.out.print("preparing warmup data...");
List<byte[]> warmupData =... | 7 |
static public int getDefaultTypeId() {
return Id3PictureType.defaultTypeId;
} | 0 |
public ArrayList get_PatientMRN(MsgParse mp)
throws SQLException {
ArrayList<String> arr = new ArrayList<String>();
try {
ResultSet rs = stmt.executeQuery("SELECT last_name, first_name, mrn, admission_type FROM Patient JOIN VISIT "
+ "ON patient.pid = visit.pati... | 2 |
public static void netToUai(BeliefNetwork bn, List vars, String filename) {
System.err.println("Saving network : " + filename);
java.io.PrintWriter pw = getPrintWriter(filename);
// preamble
Map<FiniteVariable,Integer> var2index = getVarToIndexMap(vars);
pw.println("BAYES");
pw.println(vars.size());
... | 7 |
private boolean isValidPhone(){
if(phone.length()!=12){
JOptionPane.showMessageDialog(null,"Invalid phone number entered. Must be 12 digits.","Error",JOptionPane.WARNING_MESSAGE);
return false;
}
if(phone.charAt(3)!='-'||phone.charAt(7)!='-'){
JOptionPane.showMessageDialog(null,"Invalid phone number ente... | 9 |
public void upkeep(){
level+=(Empous.Gov.getStat("infrastructure")-7)*repair_rate;
if (level>max_level)
level=max_level;
} | 1 |
public Node ceiling(int x){
Node cur = root;
while(true){
if(cur.value==x) return cur;
if(x<cur.value){
if(cur.left==null){
return cur;
}
cur = cur.left;
} else{
if(cur.right==null){
... | 7 |
public static String getQualifiedMethodName(Method method) {
Assert.notNull(method, "Method must not be null");
return method.getDeclaringClass().getName() + "." + method.getName();
} | 0 |
public static boolean promptQuestion(String question, boolean warning, String yes, String no) {
boolean answer = false;
Object[] options = {
yes,
no
};
int choice = JOptionPane.showOptionDialog(
null,
question,
warni... | 3 |
private static String getMessage(Field field) {
Localize[] annotations = field.getAnnotationsByType(Localize.class);
if (annotations.length > 0) {
for (String locale : LOCALES) {
for (Localize one : annotations) {
if (locale.equals(one.locale())) {
return one.value();
}
}
}
}
retur... | 4 |
public void paint(Graphics graphics) {
if (tree == null) return;
final Graphics2D g2 = (Graphics2D) graphics;
if (!calibrated) calibrate(g2, getWidth(), getHeight());
Paint oldPaint = g2.getPaint();
Stroke oldStroke = g2.getStroke();
for (Node selectedNode : selectedNodes) {
Shape branchPath = treeLay... | 8 |
public static boolean handleOption(int option, int longind, String arg) {
if (arg == null)
options ^= 1 << option;
else if ("yes".startsWith(arg) || arg.equals("on"))
options |= 1 << option;
else if ("no".startsWith(arg) || arg.equals("off"))
options &= ~(1 << option);
else {
GlobalOptions.err.print... | 5 |
*/
public void moveOnAxisX(Direction direction) {
if (direction.equals(Direction.RIGHT)) {
if (this.position.x + moveStep <= desert.length && !isHurdle(this.position.x + moveStep, this.position.y)) {
this.position.x += moveStep;
} else {
move();
... | 6 |
public SpinnerTimeEditor(JSpinner spinner) {
super(spinner);
if (!(spinner.getModel() instanceof SpinnerNumberModel)) {
throw new IllegalArgumentException();
}
final Pattern pattern = Pattern.compile("([0-9]+)((:|.|h)([0-5]?[0-9]))?");
DefaultFormatter formatter = new DefaultFormatter() {
@Ove... | 4 |
public int getLabelIdx(String label) throws IOException {
if (labels == null) setLabels();
if (labelMap == null) return -1;
if (!labelMap.containsKey(label)) return -1;
return (labelMap.get(label)).intValue();
} | 3 |
private HashMap<String,byte[]> readChars(byte[] d) {
// skip thru data until we find "/"+key
HashMap<String,byte[]> hm = new HashMap<String,byte[]>();
int i = findSlashName(d, "CharStrings");
if (i < 0) {
// not found
return hm;
}
PSParser psp = ne... | 6 |
public boolean jumpMayBeChanged() {
for (int i = 0; i < subBlocks.length; i++) {
if (subBlocks[i].jump == null && !subBlocks[i].jumpMayBeChanged())
return false;
}
return true;
} | 3 |
void lpc_to_curve(float[] curve, float[] lpc, float amp){
for(int i=0; i<ln*2; i++)
curve[i]=0.0f;
if(amp==0)
return;
for(int i=0; i<m; i++){
curve[i*2+1]=lpc[i]/(4*amp);
curve[i*2+2]=-lpc[i]/(4*amp);
}
fft.backward(curve);
{
int l2=ln*2;
float unit=(floa... | 4 |
public Worker () {
//initial settings
results = new ArrayList<String>();
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} | 0 |
public static Collection<BufferedImage> getFromSpritesheet(BufferedImage spritesheet, int width, int height, int spacing, int border) {
// GET THE NUMBER OF TILES VERTICALLY AND HORIZONTALLY
int horizCount = (spritesheet.getWidth() - 2 * border + spacing) / (width + spacing);
int vertCount = (sp... | 2 |
final public SimpleNode Start() throws ParseException {
/*@bgen(jjtree) START */
SimpleNode jjtn000 = new SimpleNode(JJTSTART);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
... | 9 |
public static void main(String[] args) {
try {
Experiment exp = null;
// get options from XML?
String xmlOption = Utils.getOption("xml", args);
if (!xmlOption.equals(""))
args = new XMLOptions(xmlOption).toArray();
String expFile = Utils.getOption('l', args);
Str... | 9 |
public static void main(String[] args){
User user = new User();
List<User> userList = new ArrayList<User>();
int minSize = 5;
int maxSize = 10;
user.setNick(getRandomString(minSize, maxSize));
user.setSessionKey(getRandomString(30, 50));
for (int i = 0; i < 10; i++) {
User u = new User();
u.setNick(... | 5 |
private void leave() {
if(!oldLoc.containsKey(player)){
player.sendMessage(ChatColor.AQUA+"[CopsAndRobbers]"+ChatColor.DARK_RED+"You are not in a game!");
}else{
team.removePlayer(player);
player.teleport(oldLoc.get(player));
}
} | 1 |
@Override
public E peek()
{
// This ensures a previous wakeup has ended.
E item = queue.peek();
if (blocking && item == null) {
synchronized (lock) {
// Only block if the item is null, else return it.
item = queue.peek();
if (item == null) {
try {
lock.wait(timeout);
} catch (Int... | 4 |
public void destroy(ItItemHasEmpleadoPK id) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
ItItemHasEmpleado itItemHasEmpleado;
try {
... | 6 |
public static Task getSelectedTask()
{
if (DEBUG) log("Attempting to determine selected task");
Task selectedTask = null;
if (tasks != null)
{
for(Task t : tasks)
{
if (t.isSelected())
{
selectedTask = t;
break;
}
... | 6 |
public static void main(String[] args) {
base db = new base();
db.create("/SAMPLE1.DBF", "Npk N(10), Name C(20), Rating F(5,2), Birth D, Notes M, ieee B(8,4), Id I, Salary Y");
db.Field[0].setByLong(1);
db.Field[1].setByString("Mickey");
db.Field[2].setByDouble( 3.15 );
db.Field[3].setByString("20050328"... | 6 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void setCost(double value) {
this.cost = value;
} | 0 |
private static String unescape(String in, String escChars) {
if (in == null) return null;
if (in.length() == 0) return ""; //can't be any escapes in 1-char String, and we need to guarentee one pass through the loop
escChars = escChars.concat("\\");
StringBuffer out = new StringBuffer(in.length());
char c=' ',... | 6 |
public String toDiffString(String jobId) {
String f1 = "%1$-3.0f";
String f2 = "%1$-3.1f";
float xOUdf = exOU - rxOU;
float mNGUdf = exNGU - rmNGU;
float xNGUdf = exNGU - rxNGU;
float xHeapUdf = exHeapU - rxHeapU;
float RSSdf = exHeapU - rxRSS;
float xOUrt = rxOU == 0 ? 100 : Math.abs(xOUdf) * 100... | 5 |
@Test
public void tokenize_allTokenTypes() throws Exception {
// given
final String code = "+-<>[]rw";
// when
final List<Token> tokens = tokenizer.tokenize(code);
// then
final List<Token> expectedTokens = new LinkedList<>();
for (char c : code.toCharArray(... | 1 |
public void removeEdge(Vertex v1, Vertex v2) {
for (int i = 0; i < edges.size(); i++) {
//if this edge connects v1 and v2
if (((MyEdge) edges.get(i)).contains(v1, v2)) {
//find vertices of this edge and remove them
for (int j = 0; j < vertices.size(); j++ ) {
if (v1.getElement().getX() == vertices.... | 7 |
public void kill(Player p)
{
if(p.setStackInNextAvailableSlot(getDrops()[rand.nextInt(drops.length)])){
this.remove = true;
}else{
health = maxHealth;
}
} | 1 |
public String toString() {
switch(subtype){
case 'B': {si = 0; break;}
case 'N': {si = 1; break;}
case 'P': {si = 2; break;}
case 'A': {si = 3; break;}
case 'R': {si = 4; break;}
case 'D': {si = 5; break;}
}
return "Group: "+group+"\n"+
"Address: "+address+"\n"+
"Nickname: "+nicknam... | 6 |
public BufferedImage getIdleImage(EnumDirection dir) {
BufferedImage[] idleImages = TransformImage.splitAnimation(idleStrip, 3);
switch(dir) {
case EAST: return idleImages[1];
case WEST: return TransformImage.flipHorizontally(idleImages[1]);
case NORTH: return idleImages[2];
default: return idleIm... | 3 |
String toSmallest(String in) {
char minChar = 'z' + 1;
int minIndex = in.length();
boolean refresh = true;
for (int i = 0; i < in.length(); i++) {
if (in.charAt(i) < minChar) {
minIndex = i;
refresh = false;
minChar = in.charAt... | 4 |
protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} | 0 |
@Test
public void testInfixToPostfix3() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast("*");
infix.addLast("5");
infix.addLast("+");
infix.addLast("3");
QueueInterface<String> p... | 5 |
@Override
public void refresh(Camera camera) {
if(!VerifySelectedObject())
setSelectObject();
primitives.get(namePrimitives[1]).calcCoordinates(this, camera, null);
} | 1 |
private static TimeSpan interval(double value, int scale)
{
if (Double.isNaN(value))
{
throw new IllegalArgumentException("Arg_CannotBeNaN");
}
double num = value * scale;
double num2 = num + ((value >= 0.0) ? 0.5 : -0.5);
if ((num2 > 922337203... | 4 |
public String viewToken() {
String s = "";
for (Token token : this.listaToken) {
s = s + token.getLexema() + " => " + dt.getLista().get(token.getValor_token()).getMatch() + "\n";
}
return s;
} | 1 |
@Test
public void placeFiguresKingQueenBishop() {
HashMap<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KING.toString(), 1);
figureQuantityMap.put(QUEEN.toString(), 1);
figureQuantityMap.put(BISHOP.toString(), 1);
FiguresChain kingChain = new Ki... | 7 |
public static String getName(StringBuilder sourceCode) {
String name = "";
int index = sourceCode.indexOf("<title>");
int edge = sourceCode.indexOf(" filmography - Wikipedia, the free encyclopedia</title>");
if (edge == -1) {
edge = sourceCode.indexOf(" - Wikipedia, the free encyclopedia</title>");
}
for... | 3 |
public ArrayList<Float> countSentenceLengths(String post) {
ArrayList<Float> tmpCounter = new ArrayList<>(Collections.nCopies(6, 0.0f)); // Where 6 corresponds to the number of sentence lengths of interest
// Split the post into a number of sentences
List<String> sentences = splitIntoSentences(p... | 9 |
@Override
public boolean equals(Object obj) {
boolean equal = false;
if (obj instanceof Host) {
Host host = (Host) obj;
Map<String, String> otherHostProps = host.getProperties();
boolean areAllEqual = true;
if (otherHostProps.size() == hostProperties.size()) {
for (String prop : hostProperties.keyS... | 4 |
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.