text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static User getUserFromJson(JSONObject obj){
if(obj == null)
return null;
User user = new User();
Object value = obj.get("id");
if(value != null)
{
user.setId(value.toString());
}
value = obj.get("id_room");
if(value!=null)
{
user.setId_room(value.toString());
}
val... | 9 |
public static int getDepth(Node<Integer> p){
if(p == null) return 0;
int h1 = getDepth(p.left);
if(h1 == -1) return -1;
int h2 = getDepth(p.right);
if(h2 == -1) return -1;
if(h1 >= h2){
if(h1 - h2 < 2) return h1 + 1;
return -1;
} else {
if(h2 - h1 < 2) return h2 + 1;
return -1;
... | 6 |
protected void readChildren(XMLStreamReader in) throws XMLStreamException {
Settlement oldSettlement = settlement;
Player oldSettlementOwner = (settlement == null) ? null
: settlement.getOwner();
settlement = null;
super.readChildren(in);
// Player settlement list i... | 9 |
public int diff_xIndex(LinkedList<Diff> diffs, int loc) {
int chars1 = 0;
int chars2 = 0;
int last_chars1 = 0;
int last_chars2 = 0;
Diff lastDiff = null;
for (Diff aDiff : diffs) {
if (aDiff.operation != Operation.INSERT) {
// Equality or deletion.
chars1 += aDiff.text.length();
}
if (aDiff... | 6 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerTeleport(PlayerTeleportEvent event){
Player player = event.getPlayer();
String playerName = player.getName();
Location location = event.getFrom();
String worldName = location.getWorld().getName();
if (!worldName.equals(plugin.lobbyWorld))... | 8 |
private void getPicturesPath(JTextField field) {
JFileChooser chooser = new JFileChooser();
if(ProjectMainView.actualFolder!=null)
chooser.setCurrentDirectory(ProjectMainView.actualFolder);
chooser.setDialogTitle("Chose JPEG file");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setAcceptAll... | 2 |
public int getOrthoHeight() {
return 600;
} | 0 |
public void fixOutOfBounds()
{
// prevent any invalid permeabilities
if(perm > 100)
perm = 100;
if(perm < 0)
perm = 0;
// prevent any invalid temperatures
if(temp > maxTemp)
temp = maxTemp;
if(temp < minTemp)
temp = minTemp;
// prevent any invalid pressures
if(pres > maxPres)
pres ... | 6 |
void floyd() {
int rows = d.length;
for (int k = 0; k < rows; k++)
for (int i = 0; i < rows; i++)
for (int j = 0; j < rows; j++)
if (d[i][j] > d[i][k] + d[k][j]) {
d[i][j] = d[i][k] + d[k][j];
}
} | 4 |
public ImageProcessor canny(ImageProcessor ip){
//Filter out noise
ImageProcessor result = ip.duplicate();
result.blurGaussian(sigma);
//Compute the intensity gradient using Sobel
ImageProcessor Gx = xGradient(result);
ImageProcessor Gy = yGradient(result);
//Compute the magnitude of the gradient
F... | 1 |
public static long parseTimeInterval(String str) {
try {
int len = str.length();
char suffix = str.charAt(len - 1);
String numstr;
long mult = 1;
if (Character.isDigit(suffix)) {
numstr = str;
} else {
numstr... | 7 |
public void cellRCDraw(int x, int y){
if( y % 2 == 1 ^ x % 2 == 1){
if(!sedna.getSelected() ||sedna.getSelection(x,y)){cellDraw(x,y);}}
else{
if(!sedna.getSelected() ||sedna.getSelection(x,y)){cellRandDraw(x,y);}}
} | 5 |
public void keyPressed(int code) {
if (onMenuScreen)
return;
else {
if (code >= 37 && code <= 40) { // ARROW KEYS
int dn = code - 38;
if (dn == -1)
dn = 3;
character.startMoving(directions[dn]);
}
if (code == 32) { // SPACEBAR
if (jump > 0) {
character.jump();
jump--;
... | 7 |
public Wave(int n, int d){
waveNumber = n;
difficulty = d;
waveHealth += waveNumber*10;
strengthInNumbers += waveNumber;
if (waveNumber % 10 == 0){
boss = true;
strengthInNumbers = 1;
}
if (waveNumber % 3 == 0){
status = "Heavy";
}
else if(waveNumber % 4 == 0){
status = "Light";
}... | 4 |
public void setTrainingName(String trainingName) {
this.trainingName = trainingName;
} | 0 |
public int getQuestTimeout() {
return QuestTimeout;
} | 0 |
private boolean encercleAdversaire(Couleur uneCouleur,
Position unePosition, Direction uneDirection)
{
Position laPositionVoisine = unePosition.obtenirVoisine(uneDirection);
if (!this.plateau.estPositionValide(laPositionVoisine))
return false;
Case laCaseVoisine = this.plateau.obtenirCase(laPositionVois... | 7 |
public void create(int roomNumber) {
this.setRoomNumber(roomNumber);
} | 0 |
public CmdAbst getCmdInstance(String xml) throws CumExcpIllegalCmdXML,
CumExcpIllegalCmdDoc {
Document doc = getDom(xml);
Node cmdNode = getCmdNode(doc);
String type = getCmndType(cmdNode);
String action = getAction(cmdNode);
Class<? extends CmdAbst> myClass = classMap.get(getClassName(type,
action));
... | 9 |
public static void printTime() {
// Store the minutes, seconds and milliseconds of each lap
int[] minutes = new int[lapTimes.length];
int[] seconds = new int[lapTimes.length];
int[] milliseconds = new int[lapTimes.length];
// For each lap, calculate the minutes, seconds and milliseconds
for (int lap = 0; ... | 7 |
private void notifySearchListeners(){
String recipeName = recipeList.getSelectedValue();
boolean match = false;
Recipe foundRecipe = null;
for( Recipe recipe : recipes ){
if ( recipe.getName().equals(recipeName)){
foundRecipe = recipe;
match =... | 4 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2;
g2 = (Graphics2D) g;
g2.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
if (activeLeftPanel) {
g2.setColor(... | 1 |
public boolean setInputFormat(Instances instanceInfo) throws Exception {
super.setInputFormat(instanceInfo);
m_DeltaCols.setUpper(getInputFormat().numAttributes() - 1);
int selectedCount = 0;
for (int i = getInputFormat().numAttributes() - 1; i >= 0; i--) {
if (m_DeltaCols.isInRange(i)) {
... | 9 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String input = request.getParameter("input");
ArrayList<Result> values = new ArrayList<Result>();
for(String key : context.getMapKeys()){
if(input.toLowerCase().contains(key.toLo... | 3 |
public int cld(Model model){
int res = 0;
for(Generalization g : model.getGeneralization()){
if(g.getIdentifier().equals(this.identifier)){
res = cheminPlusLongVersFeuille(model, g);
}
}
//System.out.println(res);
return res;
} | 2 |
public Boolean checkNewRoom(Tile cTile, Room nRoom){
int newRoomX = 0;
int newRoomY = 0;
/*
if (cRoom.getXPos()+nRoom.getDX() + 1 > newMap.getDim() || cRoom.getYPos()+nRoom.getDY() + 1 > newMap.getDim()){
return false;
}
if (cRoom.getXPos()-nRoom.getDX() - 1 < 0 || cRoom.getYPos()+nRoom.getDY() - 1 < 0){... | 9 |
public static Collection<SerialPortChannel> findAll() throws ChannelException {
try {
Collection<SerialPortChannel> all = new ArrayList<>();
Enumeration portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
CommPortIdentifier... | 3 |
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player player = (Player) sender;
if (commandLabel.equalsIgnoreCase("Heavy") && sender instanceof Player){
if (player.hasPermission("EasyPvpKits.Heavy")){
if (!plugin.kits.contains(player.getName())){
playe... | 7 |
public int stringHeight(String str)
{
if (str == null)
return 0;
int height = 0;
int length = str.length();
for (int i = 0; i != length; ++i)
{
int h = charHeight(str.charAt(i));
if (height < h)
height = h;
}
return height;
} | 3 |
public Boolean update(String query) {
if(this.autoCommit){
return writeData(query.replace(" ", "+"));
}
this.queries +=query.replace(" ", "+")+"\n";
return null;
} | 1 |
public void IndexCedd(String indexLoc){
System.out.println("-----Indexing images for CEDD descriptor in: " + FileLocation + "-----");
//Get all files from sub-directory
ArrayList<String> imagePaths = getFilesFromDirectory();
//Create standard config file for the index writer
IndexWriterCo... | 4 |
public void draw(int x_offset, int y_offset, int width, int height, Graphics g) {
//int xleft = x_offset + 1 + (x * (width + 1));
//int ytop = y_offset + 1 + (y * (height + 1));
//g.drawImage(lab, xleft, ytop, width, height, null);
if(contains(Mho.class)) {
((Mho)occupant).draw(x_offset, y_offset, width, hei... | 2 |
private static int getFormat(AudioFormat streamFormat) {
int format = -1;
if (streamFormat.getChannels() == 1) {
if (streamFormat.getSampleSizeInBits() == 8) {
format = IAudioDevice.FORMAT_MONO_8;
} else if (streamFormat.getSampleSizeInBits() == 16) {
format = IAudioDevice.FORMAT_MONO_16;
}
} els... | 6 |
public void moveOnFinalPath(int moveRemaning) {
System.out.println("Coin.moveOnFinalPath() " + this);
LudoRegion region = LudoRegion.values()[this.getBlockNo().getRegion() - 1];
System.out.println(this.getBlockNo().getRegion() + " Coin.moveOnFinalPath() region " + region);
if(moveRemaning > 6){
//invalid mov... | 5 |
public void vaikutaTilanteeseen(int poistetutRivit)
{
if(poistetutRivit > 0)
{
int edellisetPisteet = pelinTila.arvo(Pelitilanne.Tunniste.PISTEET);
int seuraavatPisteet = edellisetPisteet + 2 * (poistetutRivit - 1) + 1;
pelinTila.aseta(Pelitilanne.Tunniste.PISTEE... | 3 |
public IndexedModel toIndexedModel()
{
IndexedModel result = new IndexedModel();
IndexedModel normalModel = new IndexedModel();
HashMap<OBJIndex, Integer> resultIndexMap = new HashMap<OBJIndex, Integer>();
HashMap<Integer, Integer> normalIndexMap = new HashMap<Integer, Integer>();
... | 9 |
public void removeNew(int where) throws CannotCompileException {
try {
byte[] data = new NewRemover(this.get(), where).doit();
this.set(data);
}
catch (BadBytecode e) {
throw new CannotCompileException("bad stack map table", e);
}
} | 1 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Servico other = (Servico) obj;
if (this.IdServico != other.IdServico && (this.IdServico == null || !this.... | 5 |
public void game() {
/* Update the game as long as it is running. */
while (canvas.isVisible() && !restart && !player.isLevelCompleted()) {
if (!pause) {
/*If the player have lives left and have not won*/
if((player.getNumLives() > 0) && !(player.getWon())) {
updateWorld(); // Update the world
}... | 7 |
public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw new JSONException("'" + string +... | 3 |
private String constructPWhashForIPboard(String salt, String pw)
{
//$hash = md5( md5( $salt ) . md5( $cleaned_password ) );
/* this is how IPboard constructs the hash
$hash is the value stored in the database column members_pass_hash.
$salt is the value stored in the database column me... | 3 |
public void testForID_String_old() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("GMT", "UTC");
map.put("WET", "WET");
map.put("CET", "CET");
map.put("MET", "CET");
map.put("ECT", "CET");
map.put("EET", "EET");
map.put("MIT", "Pa... | 1 |
public void setItemcode(String itemcode) {
this.itemcode = itemcode;
} | 0 |
public int[][] combatBfs(List<Tile> queue, int[][] weights) {
// Initialize costMap array with 0's.
// 0 = unchecked tile.
// Anything above 0 = already checked tile
// (since cost has been assigned to it)
int[][] costMap = createEmptyCostMap();
// loop through open set and assign... | 9 |
@Test
public void testConnection() throws Throwable {
final String PIPE_NAME;
if (OS.startsWith("Windows")) {
PIPE_NAME = "\\\\.\\pipe\\libuv-java-pipe-handle-test-pipe";
} else {
PIPE_NAME = "/tmp/libuv-java-pipe-handle-test-pipe";
Files.deleteIfExists(Fi... | 7 |
public Server() throws HeadlessException, UnknownHostException {
super("A Hole In The Universe Server "
+ InetAddress.getLocalHost().getHostAddress());
setSize(1300, 700);
setLocationRelativeTo(null);
setLayout(new GridLayout(1, 2));
// The program will close when the window is closed
setDefaultCloseOpe... | 6 |
@Override
public String toString() {
return "Installation {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue + "]" : "")
+ (quality != null ? " quali... | 8 |
private void centerScreen() {
int width = this.getWidth();
int height = this.getHeight();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width - width) / 2;
int y = (screen.height - height) / 2;
setBounds(x, y, width, height);
} | 0 |
private static boolean isX86() {
String arch = System.getenv("PROCESSOR_ARCHITECTURE");
String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");
boolean isX86;
if (arch.endsWith("64") || ((wow64Arch != null) && wow64Arch.endsWith("64"))) {
isX86 = false;
} else {
... | 3 |
public void omniData(Object m){
rover = head;
while(rover != null){
if(rover.status == 1){
rover.sendObject(m);
}
rover = rover.next;
}
} | 2 |
public void run() {
String importantInfo[] = { "Mares eat oats", "Does eat oats",
"Little lambs eat ivy", "A kid will eat ivy too" };
try {
for (int i = 0; i < importantInfo.length; i++) {
// Pause for 4 seconds
Thread.sleep(4000);
// Print a message
threadMessage(importantInfo[i]);
... | 2 |
private void updateWindow()
{
if (Mission.getLastInstance() != null) {
Mission.getLastInstance().emitUpdateWindowSignal(this);
}
} | 1 |
public List<String> anagrams(String[] strs) {
List<String> result = new ArrayList<String>();
Map<String,List<String>> map = new HashMap<String,List<String>>();
for (int i = 0; i < strs.length ;i++ ) {
char[] c = strs[i].toCharArray();
Arrays.sort(c);
List<Stri... | 4 |
@EventHandler
public void PigZombieWither(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.getPigZombieConfig().getDouble("PigZombie... | 6 |
private static void Move(IHIPathfinderValues values)
{
values.Tiles[values.X[values.BinaryHeap[1]]][values.Y[values.BinaryHeap[1]]] = 2;
values.BinaryHeap[1] = values.BinaryHeap[values.Count];
values.Count--;
short location = 1;
while (true)
{
short hig... | 7 |
public void mousePressed(MouseEvent e) {
buttonSelected = controller.buttonSelected;
if (buttonSelected == null)
return;
pointClicked = e.getPoint();
// MAKING A SELECTION
if (buttonSelected == ButtonSelected.SELECT) {
// a shape has already been selected and now the handles have been selected
if ... | 6 |
private void newChannelGroup(String args[]){
int i = 2;
String name = "";
if(args[i].startsWith("\"")){
while(!args[i].endsWith("\"") && i < args.length-1){
if(!name.isEmpty())
name += " ";
name += args[i];
i++;
}
if(!name.isEmpty())
name += " ";
name += args[i];
i++;
na... | 9 |
public void stop(StageFlipper flipper) {
if (flipper.packageID == 102) {
if (flipper.jm.GameType.equals("TicTacToe")) {
this.lastMsg = flipper;
this.stage = 20;
} else if (flipper.jm.GameType.equals("Achtung Die Kurve")) {
this.lastMsg = flipper;
this.stage = 30;
}
} else if (flipper.pack... | 4 |
private void pressed(KeyEvent e, String text)
{
int key = e.getKeyCode();
//VK_SPACE = space bar
if(key == KeyEvent.VK_SPACE && !drawingLevel)
{
fired = true;
}
//VK_UP = Up arrow
if (key == KeyEvent.VK_UP)
{
upArrowPressed = true;
}
if (key== KeyEvent.VK_X)
{
superJumpPressed =... | 6 |
public synchronized Client editClient(Client client) {
if (client != null) {
for (Client clientAux : listClient) {
if (clientAux.getMail().equals(client.getMail())) {
listClient.remove(clientAux);
try {
listClient.put(client);
} catch (InterruptedException e) {
e.getMess... | 5 |
private BufferedYamlConfiguration loadConfig(final File base, final String world) {
BufferedYamlConfiguration config = this.configuration.get(world);
if (config != null) return config;
final File source = (world == null ? base : new File(base, world + ".yml"));
try {
config ... | 4 |
@Override
public String getStat(String code)
{
if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
return CMLib.coffeeMaker().getGenItemStat(this,code);
switch(getCodeNum(code))
{
case 0:
return "" + powerCapacity();
case 1:
return "" + activated();
case 2:
return "" + powerRemaining();
case ... | 8 |
public static EnumOs getPlatform()
{
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if(osName.contains("win"))
{
return EnumOs.WINDOWS;
}
if(osName.contains("mac"))
{
return EnumOs.MACOS;
}
if(osName.... | 6 |
public BallIterator(BallContainer ballContainer) {
this.ballContainer = ballContainer;// 将操作的“盆”传入,参考上面的代码
this.index = 0;
} | 0 |
public String getParts(int index){
try{
return parts.get(index);
} catch (IndexOutOfBoundsException e){
}
return null;
} | 1 |
public Track(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "default":
defaultt = Default.parse(this, v);
break;
case "kind":
kind = Kind.parse(this, v);
br... | 6 |
public static void main(String[] args) {
if (args.length == 0) {
UI.run(path);
} else if (args.length == 1) {
path = args[0];
UI.run(path);
} else if (args.length == 2) {
path = args[0];
tries = Integer.parseInt(args[1]);
Launcher.launchBatch(path, mode, tries);
}else if (args.length == 3) {
... | 5 |
public void insertarCuenta(int numCuenta){
try {
r_con.Connection();
String fechaDesde=campoFecha.getText();
String fechaHasta=campoFecha1.getText();
int numAsiento=-1;
... | 5 |
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
JFileChooser chooser = new JFileChooser("/");
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
jTextField3.setText(chooser.g... | 1 |
private void mergeArray(int start, int mid, int end) {
if(mid<start || end<mid+1) {
return;
}
int[] tmp = new int[end-start+1];
int tmpIdx=0;
int i = 0;
int j = 0;
while(i<mid-start+1&&j<end-mid) {
if(array[start+i]<array[mid+1+j]) {
tmp[tmpIdx++] = array[start+i];
i++;
} else {
tm... | 8 |
public Fornecedor buscarFornecedor(String nome) {
for (Fornecedor f : fornecedores) {
if (f.getNome().compareToIgnoreCase(nome) == 0) {
return f;
}
}
return null;
} | 2 |
public boolean getIncludeSubDirs() {
return this.includeSubDirs;
} | 0 |
public AudioFormat[] getTargetFormats(final AudioFormat.Encoding targetEncoding,
final AudioFormat sourceFormat)
{
if (sourceFormat.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED) &&
targetEncoding instanceof SpeexEncoding) {
if (sourceFormat.getChannels... | 7 |
public void promptMove(GoEngine g) {
List<Coord> moves = new ArrayList<Coord>();
g.board.calculateTerritory();
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
if(g.board.checkValid(i,j,piece)&&g.board.getTerritory(i, j)!=piece){
moves.add(new Coord(i,j));
}
}
}
if(moves.size()!=0){
Coord mov... | 6 |
public void testPropertyCompareToMonth() {
YearMonthDay test1 = new YearMonthDay(TEST_TIME1);
YearMonthDay test2 = new YearMonthDay(TEST_TIME2);
assertEquals(true, test1.monthOfYear().compareTo(test2) < 0);
assertEquals(true, test2.monthOfYear().compareTo(test1) > 0);
assertEqual... | 2 |
public Connection getConnection(){
return connection;
} | 0 |
public int powerMod(String binaryKey, Integer caracter, Double n){
BigInteger a = BigInteger.valueOf(caracter);
BigInteger aux = BigInteger.valueOf((int)caracter);
for (int i=1;i<binaryKey.length();i++){
System.out.print( aux +" ");
if(binaryKey.charAt(i)=='1'){
... | 2 |
public String getVisiteur() {
return visiteur;
} | 0 |
public void saveSettings() {
FileWriter xmlfile;
String line;
// Open the default file settings //
try {
xmlfile=new FileWriter("rivet_settings.xml");
// Start the XML file //
line="<?xml version='1.0' encoding='utf-8' standalone='yes'?>\n<settings>\n";
xmlfile.write(line);
// Invert
line="<in... | 7 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// consulta de la base de datos
try {
//Establece los valores para la sentencia SQL
Connection c=con.conectar();
PreparedStatement consultar = c.prepareStat... | 9 |
public List<Disciplina> consultaDisciplinasPorPreferenciaPorProfessor(
String matriculaProfessor, int nivelPreferencia)
throws ProfessorInexistenteException, PreferenciaInvalidaException {
List<Disciplina> listaRetorno = new ArrayList<Disciplina>();
for (Professor p : professores) {
if (p.getMatricula().... | 2 |
public AutomatonAction getRestoreAction() {
return restoreAction;
} | 0 |
private static void tryDo(String s, int i, int j){
int len = j-i;
int sLen = s.length();
for(int k=0;k<len;k++){
if((j+k<allowed && j+k>=sLen) || (i+k<sLen && j+k<sLen && s.charAt(i+k)==s.charAt(j+k))){
continue;
} else {
return;
}
}
max = Math.max(len*2, max);
} | 6 |
private void processPlayers() {
for (HostedConnection each : getClients()) {
Boolean init = each.getAttribute(AttributeKey.INIT);
if(init==null) {
continue;
}
if (!init) {
//
Player p = pf.producePlayer();
... | 5 |
private static String toString(ArrayList<String> al) {
String string = "";
for(String str : al) {
String build = string;
string = build + str;
}
return string;
} | 1 |
private static Field findDeclaredField(Class<?> inClass, String fieldname)
throws NoSuchFieldException {
while (!Object.class.equals(inClass)) {
for (Field field : inClass.getDeclaredFields()) {
if (field.getName().equalsIgnoreCase(fieldname)) {
return field;
}
}
inClass = inClass.getSuperclas... | 4 |
static Direction clockwise(Direction direction) {
if (direction == NORTH) return EAST;
if (direction == EAST) return SOUTH;
if (direction == SOUTH) return WEST;
return NORTH;
} | 3 |
private static BigInteger[] fraction(double val){
long bits = Double.doubleToLongBits(val);
int sign = ((bits >> 63) == 0) ? 1 : -1;
int exp = (int)((bits >> 52) & 0x7ffL);
if(exp == 2047){
throw new ArithmeticException("The double value "+val+" is Infinity or NaN, can't be represented as rational number");
... | 7 |
@Override
public boolean free(ByteBuffer buffer)
{
boolean cached = false;
// If caching this buffer will go over the maximum allowable cached
// buffer memory then simply free the buffer and return the result.
if (usedMemory.get() + buffer.capacity() > maxMemory.get()) {
onFree(buffer);
}
// Try cach... | 2 |
public void rightClick(Tile tile, boolean shift, Point target, Point worldBound){
if(shift)
{
setCamera(target,worldBound);
}
else
{
if(selected == null || selected.getClass().getSuperclass() == Terrain.class)
{
setCamera(target... | 4 |
public DMemeGrid getRigorData() {
DMemeGrid dmg = new DMemeGrid();
String sql = "SELECT \n"
+ " BP.accountID, MSP.projectID, MSP.siteID, BP.name AS projectName\n"
+ ", BSite.disname AS districtName, BSite.schname AS schoolName\n"
... | 7 |
private void setState(Request request, Response response, String status) {
for (String s : request.getValidStates()) {
if (status.equals(s)) {
response.setMatchOk(true);
break;
}
}
if (!response.isMatchOk() && request.getErrorStates() != null) {
for (String s : request.getErrorStates()) {
if... | 8 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(sprung)
return super.okMessage(myHost,msg);
if(!super.okMessage(myHost,msg))
return false;
if((msg.amITarget(affected))
||((msg.tool()!=null)&&(msg.tool()==affected)))
{
if((msg.targetMinor()==CMMsg.TYP_ENTER)
... | 9 |
@Override
protected void generateLevel() {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
tilesInt[x + y * width] = random.nextInt(4);
}
}
} | 2 |
public Component getListCellRendererComponent(
JList jlist,
Object e,
int index,
boolean isSelected,
boolean cellHasFocus)
{
this.viewer.setObject(e);
Color background;
Color foreground;
// check i... | 4 |
@Override
public void mouseDragged(MouseEvent event) {
if (isEnabled()) {
Row rollRow = null;
try {
int x = event.getX();
mSelectOnMouseUp = -1;
if (mDividerDrag != null && allowColumnResize()) {
dragColumnDivider(x);
JScrollPane scrollPane = UIUtilities.getAncestorOfType(this, JScrollPan... | 5 |
public Gleitpunktzahl add(Gleitpunktzahl r) {
/*
* TODO: hier ist die Operation add zu implementieren. Verwenden Sie die
* Funktionen normalisiere, denormalisiere und die Funktionen add/sub
* der BitFeldklasse. Achten Sie auf Sonderfaelle und die Einschraenkung
* der Funktion BitFeld.sub.
*/
if (th... | 8 |
private RatingResult predictUserRating(DBObject reviewObject) {
if (reviewObject == null)
return null;
if (!reviewObject.containsField(CollectionReview.KEY_USER_ID)
|| !reviewObject
.containsField(CollectionReview.KEY_BUSINESS_ID)
|| !reviewObject.containsField(CollectionReview.KEY_STARS)) {
ret... | 8 |
public static void main( String[] args ) throws NoSuchMethodException, SecurityException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException
{
// 1 access static class
System.out.println( "directly " + StaticExample.... | 7 |
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.