text stringlengths 14 410k | label int32 0 9 |
|---|---|
public List<Square> getClickableSurround(int i, int j) {
List<Square> squares = new ArrayList<Square>();
for (int x = i - 1; x <= i + 1; x++) {
for (int y = j - 1; y <= j + 1; y++) {
if (positionExists(x, y) || (x == i && y == j)) continue;
Square s = board[x][y];
if (!s.isFlagged() && !s.isReve... | 7 |
public void setIdLogEnt(int idLogEnt) {
this.idLogEnt = idLogEnt;
} | 0 |
@Override
public boolean onCommand(CommandSender sender, Command command, String sabel, String[] args) {
if (Utils.commandCheck(sender, command, "sub")) {
Player player = (Player) sender;
if (args.length == 0) {
// /power - displays power help
// /power list - displays all powers (elements), with green... | 8 |
public synchronized void create_tables()
{
Connection c = null;
try
{
clearSoftState();
c = connectionPool.getConnection();
Statement s = c.createStatement();
s.executeQuery("show tables");
for( String t : CREATE_TABLES )
{
try {
s.execute(t);
} catch( Exception e ) {
... | 8 |
public void mousePressed(MouseEvent event) {
Transition t = getDrawer().transitionAtPoint(event.getPoint());
if (t != null) {
controller.transitionCollapse(t.getFromState(), t.getToState());
}
} | 1 |
private ArrayList<Card> returnPairSetup()
{
ArrayList<Card> setup = new ArrayList<>();
if (compareCardFigures(0, 1))
{
setup.add(cards.get(0));
setup.add(cards.get(1));
}
else if (compareCardFigures(1, 2))
{
setup.add(cards.get(1)... | 3 |
public boolean isAlive() {
if (this.getWorld() == null)
return false;
if(!this.getWorld().liesWithinBoundaries(this))
return false;
if (this.getCurrentHitPoints() == 0)
return false;
return true;
} | 3 |
@Override
public List<Object> getAll(int gameID){
try {
db.start();
DBCollection collection = db.getDB().getCollection("moves");
XStream xStream = new XStream();
DBCursor cursor = collection.find();
if (cursor == null)
return null;
List<Object> commands = new ArrayList<Object>(... | 4 |
@Override
public List<String> onTabComplete(CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) {
if(!cmd.getName().equals(cmdName) || args.length > 1) {
return null;
}
List<String> results = new LinkedList<>();
boolean ignoreArg = false;
... | 7 |
private boolean pointCollides(double x, double y){
for (Building b : model.getBuildings()){
Rectangle rect = (Rectangle) b.getShape();
if (x <= rect.getX()+rect.getWidth() && x >= rect.getX()
&& y <= rect.getY()+rect.getHeight() && y >= rect.getY()){
... | 5 |
public static int getOrder(Enemy enemy){
//命令
int order = 0 ;
//boss坦克在数组中的位置
int boss_y = Game.BOSS_TANK_X * Constant.WIDTH_HEIGHT ;
int boss_x = Game.BOSS_TANK_Y * Constant.WIDTH_HEIGHT ;
//敌人位置
int x = enemy.getLocation_x() ;
int y = enemy.getLocation_y() ;
//
String[] mapArray = enemy.getMainFra... | 7 |
public void saveParamDiffsData(int cGeneration, Hypothesis h)
{
int hIndex = 0;
int[] diffs = new int[targetValues.length];
for (int i = 0; i < targetValues.length; i++)
{
//Convert each block of five bits to an integer value
String binStr = "";
fo... | 5 |
@Test
public void testMyComparer()
{
assertTrue(true);
} | 0 |
public String leerOpcion() throws IOException, SQLException, ParseException {
String input = bf.readLine();
if(input.equals("1")){
agregarInsumo();
}else if(input.equals("2")){
consumirInsumo();
}else if(input.equals("3")){
buscarInsumo();
}else if(input.equals("4")){
agregarCantidadInsumo();
}e... | 5 |
private OSXApplicationProxy() {
try {
final File file = new File("/System/Library/Java");
if(file.exists()) {
ClassLoader scl = ClassLoader.getSystemClassLoader();
Class<?> clc = scl.getClass();
if(URLClassLoader.class.isAssignableFrom(clc)... | 9 |
public void run() {
log.logDebug( "MockAgent.Worker started");
ISemiSpaceTuple t=null;
String cargo;
while(isRunning) {
t = blackboard.read(template, 1000); // leave up to a second
System.out.println("MockAgent read "+t+" "+isRunning);
if (t == null) {
synchronized(synchObject) {
try ... | 6 |
public static String maximumNonDuplicateSubstring(String str)
{
Set<Character> encountered = new HashSet<Character>();
int i = 0,
firstCharacterIndex = 0,
count = 0,
largestCharacterIndex = 0,
largestCount = -1;
while (i <= str.length())
{
if (i == str.length())
{
System.out.printl... | 6 |
public boolean mouseInRegion(int x1, int x2, int y1, int y2) {
if (getScale() != 1) {
x2 = (int) ((x2 - x1) * getScale());
x1 *= getScale();
x2 += x1;
y2 = (int) ((y2 - y1) * getScale());
y1 *= getScale();
y2 += y1;
x1 += Main.scaledX;
x2 += Main.scaledX;
y1 += Main.scaledY;
y2 += Main.s... | 5 |
@EventHandler
public void onEntityDeath(EntityDeathEvent e) {
Player player = e.getEntity().getKiller();
if (!(e.getEntity() instanceof Player)) {
e.getDrops().clear();
e.getEntity().getEquipment().setBootsDropChance(0);
e.getEntity().getEquipment().setHelmetDropChance(0);
e.getEntity().getEquipment().... | 8 |
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpSession session = req.getSession(true);
int uid = (int)((User)session.getAttribute("currentSessionUser")).getId();
//HashMap<Product,Integer> cart = (HashMap<Product,Integer>)session.getAttribute("ca... | 2 |
public void setDeleted(boolean deleted) {
this.deleted = deleted;
} | 0 |
private boolean isTwoPair(ArrayList<Card> player) {
ArrayList<Integer> sortedHand=new ArrayList<Integer>();
sortedHand=sortHand(player);
int pair1Counter=0;
int pair2Counter=0;
int pair1Int=100;
int pair2Int=100;
for(int i=0;i<player.size()-1;i++) {
if(sortedHand.get(i)==sortedHand.get(i+1)){
if(sortedHan... | 6 |
public void givePin() {
if(dead || flyingType || crashed) {
return;
}
if (pinned)
{
pinned = false;
setHappiness(Happiness.AVERAGE);
return;
}
if(!pinned) {
if(sleeping) wakeup();
staycount = 0;
staying = false;
setToFood(false);
toSukkiri = false;
setToShit(false);
shitting... | 6 |
public String getCurTime(){
Date d = new Date ();
String date_str="";
if(d.getHours()<10)
date_str="0";
date_str+=d.getHours()+":";
if(d.getMinutes()<10)
date_str+="0";
date_str+=d.getMinutes()+":";
if(d.getSeconds()<10)
date_str+="0";
date_str+=d.getSeconds()+":";
... | 4 |
private void setFrameVer(){
modificar.setVisible(true);
modificar.setTitle("Ver Producto");
modificar.setSize(500, 300);
} | 0 |
@Override
public void runClient(GameEntity entity, float delta) {
if(physics != null) {
Vector3 position = physics.getPosition();
decal.setPosition(position.x + offset.x, position.y + offset.y, position.z + offset.z);
if(up != null && rot != null) {
decal.setRotation(rot, up);
} else {
decal.... | 7 |
protected void writeAttributes(GrowableConstantPool constantPool,
DataOutputStream output) throws IOException {
int count = getKnownAttributeCount();
if (unknownAttributes != null)
count += unknownAttributes.size();
output.writeShort(count);
writeKnownAttributes(constantPool, output);
if (unknownAttribu... | 3 |
public static void addConj (String conj) {
switch (conjState) {
case -1:
days[dayNum].conj[days[dayNum].conjNum].conj[0] = conj;
System.out.print("Yo Form: ");
conjState++;
break;
case 0:
days[dayNum].conj[da... | 6 |
public void debuffRecovery(){
recovery++;
if (cc == EARTH && recovery >= 80){
entombed = false;
jolly = true;
recovery = 0;
}
else if (cc == WATER && recovery >= 60){
slowed = false;
jolly = true;
recovery = 0;
}
else if (cc == WIND && recovery >= 40){
knockedback = false;
... | 8 |
public int getWidth() {
return width;
} | 0 |
public BigDecimal weightedMean_as_BigDecimal() {
if (!weightsSupplied) {
System.out.println("weightedMean_as_BigDecimal: no weights supplied - unweighted mean returned");
return this.mean_as_BigDecimal();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weightingOptionI) {
... | 6 |
@Test
public void testCastingToVoid() {
assertNull(ValueType.VOID.cast(null));
try {
ValueType.VOID.cast(false);
fail();
} catch(ClassCastException e) {
// empty block
}
try {
ValueType.VOID.cast((byte) 1);
fail();
} catch(ClassCastException e) {
/... | 9 |
public void stopLiveWindowMode() {} | 0 |
@Override
public void mouseClicked(MouseEvent e) {
// Double-click event.
if (e.getClickCount() >= 2) {
// Prevent the user from taking another screenshot while cropping.
if (cropWindow != null && !cropWindow.canSave())
return;
// Get ... | 5 |
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof Name)
return name.equals(((Name) obj).getName());
return obj instanceof String && name.equals(obj);
} | 3 |
public static void main(String args[]) {
Enumeration days;
Vector dayNames = new Vector();
dayNames.add("Sunday");
dayNames.add("Monday");
dayNames.add("Tuesday");
dayNames.add("Wednesday");
dayNames.add("Thursday");
dayNames.add("Friday");
dayName... | 1 |
public static BigInteger calculateRepresentationNumber(Cell[] currentBoard){
BigInteger out = BigInteger.ZERO;
Cell actualCell;
int ibase = Piece.values().length + 2;
BigInteger base = BigInteger.valueOf(ibase);
for(int i=0; i < currentBoard.length;i++)... | 4 |
public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
checkState();
checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE
+ Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC
+ Opcodes.ACC_FINAL + Opcodes.ACC_SYNCHRONI... | 4 |
private void method46(int i, Stream stream) {
while(stream.bitPosition + 21 < i * 8) {
int k = stream.readBits(14);
if(k == 16383)
break;
if(npcArray[k] == null)
npcArray[k] = new NPC();
NPC npc = npcArray[k];
npcIndices[npcCount++] = k;
npc.anInt1537 = loopCycle;
int l = stream.readBits(... | 6 |
public void setPosition(Position currentpos) {
this.CurrentPosition = currentpos;
if (!this.trail.contains(currentpos)) {
trail.add(currentpos);
PlayerTrail.add(currentpos);
}
} | 1 |
public GameResult getGameStatus() {
if (getMafiaCount() == 0) return GameResult.VillagerWins;
else if (getVillagerCount() <= getMafiaCount()) return GameResult.MafiaWins;
return GameResult.GameStable;
} | 2 |
@Override
public int onTrailerFound(COSDictionary trailer, int ordering) {
if (ordering == 0) {
rootID = trailer.getReference(COSName.ROOT);
infoID = trailer.getReference(COSName.INFO);
documentIsEncrypted = trailer.containsKey(COSName.ENCRYPT);
COSArray Ids... | 9 |
public void actionPerformed(ActionEvent event)
{
String actionCommand = event.getActionCommand();
if (actionCommand.equals("BROWSE")) {
int returnVal = browse.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
fileLoc.setText(browse.getSelectedFile().getPath());
searchButton.set... | 8 |
protected String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i... | 7 |
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 to
* string. If we reach an early end, bail.
*/
for ... | 9 |
public void actionPerformed(ActionEvent event)
{
if(event.getActionCommand().equals("Add"))
{
String name = userField.getText().trim();
if (name.equals("") || name.equals("Enter User Name"))
JOptionPane.showMessageDialog(null, "Invalid User Name");
else
{
String key = randomKeyGenerator();
... | 9 |
private Peer getMostUpdatedPeer() {
int newestVersion = handle.getVersion();
Peer mostUpdatedPeer = null;
for (Map.Entry<Integer, Peer> entry : peersTable.entrySet()) {
Integer id = entry.getKey();
Peer peer = entry.getValue();
log.addLogEntry("Checking connectivity with Peer " + id);
int peerVersion... | 8 |
double getDefence(Match match, Team team) {
int countMatches = 0;
int[] goals = new int[deep];
Match currentMatch = getPrevMatch(team, match);
for (int i = 0; i < deep && currentMatch != null; i++, currentMatch = getPrevMatch(
team, currentMatch), countMatches++) {
... | 4 |
public static int checkRequirements(MapleCharacter player, int itemId) {
int cat = getItemType(itemId);
if (cat > 1000) {
return 1;
} else if (MapleItemInformationProvider.getInstance().getSlotMax(itemId) < 1) {
return 2;
} else {
int taocount = player... | 7 |
public void run(){
do{
int randy = (int)(Math.random()*100);
if(((randy%2)==0) & (actual>0) ){ // Consumidor
lleno.esperar();
mutex.esperar();
// zona critica
cont++;
actual--;
... | 4 |
public HashMap<String, String> getParsedRequest(BufferedReader inFromUser) throws SocketTimeoutException,
IOException {
resultMap = new HashMap<String, String>();
parametersMap = new HashMap<String, String>();
String line = inFromUser.readLine();
// if end of the stream has been reached notify process threa... | 9 |
final void method500ms() {
long timeMillis = System.currentTimeMillis();
while (true) {
if (System.currentTimeMillis() > timeMillis + 500)
return;
for (int i = 0; i < 10_000; i++) {
// busy wait
if (i == 10_000)
break;
}
}
} | 4 |
public void run(){
while(!finished && !failed){ // бесконечный цикл
chooseNextNode(); // обхода вершин
visitNextNode(); // и оставление феромонов в них
writePheromon(); // запоминает, куда должен оставить феромоны
... | 5 |
private Integer addResults(MyRecursiveTask task1, MyRecursiveTask task2) {
int value;
try {
value = task1.get().intValue() + task2.get().intValue();
} catch (InterruptedException e) {
e.printStackTrace();
value = 0;
} catch (ExecutionException e) {
... | 3 |
public ListNode reverseKGroup(ListNode head, int k) {
ListNode header = new ListNode(0);
header.next = head;
ListNode[] nodes = new ListNode[k];
int count = 0;
ListNode pre = header;
ListNode p = head;
while (p!=null){
while(p!=... | 6 |
@Override
public void removeClientConnectListener(ConnectOnServerListener listener) {
if (clientConnectListenerList != null) {
clientConnectListenerList.remove(ConnectOnServerListener.class, listener);
}
} | 1 |
private static Body fullyConnectBody( int boxWidth, int boxHeight, Body body ) {
for( int heightIdx = 0; heightIdx < boxHeight; heightIdx++ )
for( int widthIdx = 0; widthIdx < boxWidth; widthIdx++ )
{
if( widthIdx < boxWidth -1 )
body.connectShape( bod... | 4 |
protected void paintComponent (Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
Rectangle rect;
for (int i = 0; i < circles.size(); i++) {
rect = circles.elementAt(i);
g2d.setStroke(new BasicStroke(3.0f));
g2d.setColor(Color.black);
g2d.drawString(nodeList.get(i).g... | 3 |
public wordsDocument(String phrase) {
String text = onlyText(phrase);
String[] temp = text.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\)", "").replaceAll("\\(", "").split(" ");
for (String current : temp) {
current = current.replaceAll("[\n,.?!:\";'']", "");
if (current.contains("'... | 4 |
public LoginWindow() {
super(500,190);
getContentPane().setLayout(null);
usernameLabel = new JLabel();
usernameField = new JTextField(25);
passwordLabel = new JLabel();
passwordField = new JPasswordField(25);
loginButton = new JButton(NavalBattle.getLocalizationManager().getString("login_login"));
JButt... | 6 |
public void cambiarPesoNodo(long target, int peso) {
for (int i = 0; i < connections.getLength(); i++) {
Connection connection = connections.get(i);
if (connection.getTarget()==target) {
connection.setPrecio(peso);
difusion(XmlToolkit.crearCambioPeso(this.... | 2 |
public static boolean propertyEqualsAsString(PropertyContainer container, String key, String test_value) {
if (container != null) {
return container.propertyEquals(key, test_value);
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} | 1 |
private void editRackProperties(){
RackPropertiesDialog dlg = new RackPropertiesDialog(this.r.getRackProperties(),this, "Edit Rack Properties", "table goes here...");
if (dlg.getExitWithOK()){
String propName = "rows";
String str = "";
try {
this.r.getRackProperties().set... | 8 |
protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < ... | 9 |
public int computeLCS(int i, int j)
{
if ((i == 0) || (j == 0))
return 0;
if (length[i][j] > 0)
return length[i][j];
if (seq1[i] == seq2[j]) {
length[i][j] = computeLCS(i-1, j-1) + 1;
indices[i][j] = I * (i-1) + j-1;
} else if... | 5 |
@Override
public boolean equals(Object o) {
if (!(o instanceof Container)) return false;
Container container = (Container) o;
if (UUID != null ? !UUID.equals(container.UUID) :
container.UUID != null)
return false;
if (id != null ? !id.equals(container.id... | 9 |
private String randomCard(int i) {
String card; // String carte a retourner
// Affecte la string carte au cas par cas en fonction de la valeur de l'entier.
switch (i) {
case 0:
card = "chevalier";
break;
case 1:
card = "monopole";
break;
case 2:
card = "route";
break;
case 3:
... | 5 |
public void beginContact(Contact c) {
Fixture fa = c.getFixtureA();
Fixture fb = c.getFixtureB();
if(fa.getUserData() != null && fa.getUserData().equals("foot")) {
numFootContacts++;
}
if(fb.getUserData() != null && fb.getUserData().equals("foot")) {
numFootContacts++;
}
if(fa.getUserData()... | 8 |
public static HsvImage convertToHsv(RgbImage rgb) {
HsvImage hsv = new HsvImage(rgb.getWidth(), rgb.getHeight());
for (int x = 0; x < rgb.getWidth(); x++) {
for (int y = 0; y < rgb.getHeight(); y++) {
HsvPixel px = convertPixel(rgb, x, y);
hsv.setPixel(x, y, HUE, px.hue);
hsv.setPixel(x, y, SATURATIO... | 2 |
@Override
public boolean startVideoProcessing(File videoFile) {
if (!videoFile.exists())
return false;
processThread = createProcessThread(videoFile, this.mediator);
// Start
processThread.start();
return true;
} | 1 |
public static void htmlDescribeInstances(String title, String head, NamedDescription relation, org.powerloom.PrintableStringWriter stream, boolean ruleP) {
{ Cons instances = edu.isi.powerloom.PLI.getConceptInstances(relation, null, null).consify();
Cons assertedinstances = Logic.ASSERTION_INFERENCE.levellize... | 7 |
PluginClassLoader(final ClassLoader parent, String main, final File file) throws InvalidPluginException, MalformedURLException {
super(new URL[] {file.toURI().toURL()}, parent);
try {
Class<?> jarClass;
try {
jarClass = Class.forName(main, true, this);
... | 6 |
public WhereIterable(Iterable<T> source, Predicate<T> predicate)
{
this._predicate = predicate;
this._source = source;
} | 0 |
public static String[] format(String[] text)
{
int max = 0;
int n = 0;
StringBuilder sb;
for(int i = 0; i < text.length; i++)
{
if(text[i].length() > max)
max = text[i].length();
}
for(int i = 0; i < text.length; i++)
{
sb = new StringBuilder();
if(text[i].length() < max)
{
n ... | 5 |
public static boolean compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2) {
if (bufferedImage1.getWidth() == bufferedImage2.getWidth() && bufferedImage1.getHeight() == bufferedImage2.getHeight()) {
for (int x = 0; x < bufferedImage1.getWidth(); x++) {
f... | 5 |
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
Point p = (Point) obj;
return properties == null ? p.properties == null : properties.equals(p.properties);
} | 2 |
public void setZonesCount(int xCount, int yCount) {
if(xCount > 64 || yCount > 46) {
try {
game.myControle.writeToDebugFile("Could not load that many zones. Maximum 1024*1024!");
} catch (IOException e) {
System.out.println("Error setting zones in class Ma... | 3 |
public void cargarArchivo(){
try
{
FileInputStream fileIn = new FileInputStream("configurations.txt");
ObjectInputStream in = new ObjectInputStream(fileIn);
ArrayList<Configuracion> confi;
confi = (ArrayList<Configuracion>) in.readObject();
if(confi... | 2 |
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
if (HyperPVP.isCycling()) {
event.setCancelled(true);
}
if (!HyperPVP.hasMatchBeenAnnounced()) {
event.setCancelled(true);
return;
}
for (Region region : HyperPVP.getMap().getRegions(RegionType.TEAM)) {
if (region.h... | 8 |
private void updateResiduesComputedMenu(String group3List, int[] group3Counts, boolean popup) {
if (group3List == null || group3Counts == null)
return;
JMenu menu = popup ? residuesComputedMenu2 : residuesComputedMenu1;
if (menu == null)
return;
for (int i = 0; i < menu.getItemCount(); i++) {
proteinGr... | 8 |
public void testByteIntConvert() {
int expect = 8;
byte[] bytes = ByteUtils.intToByteArray(expect);
int i = ByteUtils.byteArrayToInt(bytes);
assertEquals(expect, i);
expect = -8;
bytes = ByteUtils.intToByteArray(expect);
i = ByteUtils.byteArrayToInt(bytes);
assertEquals(expect, i);
expect = -255;
... | 0 |
@Override
public boolean hasNext() {
if (first == null)
return false;
return !(current == null);
} | 1 |
public Tile[][] getTiles() {
return this.map;
} | 0 |
public GestionarProducto(){
try{
//obtenemos el driver de para mysql
Class.forName("org.gjt.mm.mysql.Driver");
//obtenemos la conexión
connection = DriverManager.getConnection(url,login,password);
}
catch(SQLException e){
System.out.pri... | 3 |
@Override
public void destroyTarget() throws Exception {
Object arr[] = {this, target};
double rate = 3;// Math.random(); // generate random success
if (target.isRunning()) {
if (!target.isHidden()) {
// if rate bigger than success rate it will destroy
if (rate > War.SUCCESS_RATE) {... | 8 |
private static char[] getQualityColumn (Alignment layoutMap, int index) {
List<Read> reads = new ArrayList<Read>();
for (Read lay : layoutMap.values()) {
if (lay.getOffset() <= index && index < lay.getOffset() + lay.getLength()) {
reads.add(lay);
}
}
char[] column = new char[reads.size()];
for (i... | 4 |
@SuppressWarnings("unchecked")
@Get
public ExeReport login() {
String login = (String) getRequest().getAttributes().get("login");
String password = (String) getRequest().getAttributes().get("password");
EntityManager em = emf.createEntityManager();
List<Account> targets = null;
String queryString = "sel... | 3 |
public static Utilisateur activerCompte(String url) throws RuntimeException {
CourrielActivation c = CourrielActivationRepo.get().deLUrl(url);
if (c == null)
return null;
EntityTransaction transaction = UtilisateurRepo.get().transaction();
try {
transaction.begi... | 3 |
public static void main(String[] args) {
InetAddress ip = null;
Socket clientSocket = null;
try {
ip = InetAddress.getByName("localhost");
clientSocket = new Socket (ip, 1801);
// поток для передачи векторов серверу
BufferedWriter out = new Buffe... | 4 |
public byte[] getBlock(int address, int blockSize) {
int offset = 0;
for (int i = 0; i < offsetBits; i++) {
offset |= address & (1 << i);
}
address >>= offsetBits;
int index = 0;
for (int i = 0; i < indexBits; i++) {
index |= address & (1 << i);
}
address >>= indexBits;
int tag = 0;
for (int i... | 7 |
public List<Integer> getClientIds() {
synchronized(CONNECTION_LOCK) {
List<Integer> clientIds = new ArrayList<Integer>();
for(Integer clientId: clients.keySet()) {
if(clients.get(clientId) != null)
clientIds.add(clientId);
}
return clientIds;
}
} | 2 |
public int getInitialWidth() {
return initialWidth;
} | 0 |
public boolean sendCommand(String p_command) {
int indexInit = p_command.indexOf(".");
if (indexInit < 0) {
return false;
}
String deviceName = p_command.substring(0, indexInit);
String command = p_command.substring(indexInit + 1);
if (deviceName.equals(this.name) && command.equalsIgnoreCase("GETPOS")) ... | 6 |
public boolean getBoolean( String name ){
XAttribute attribute = getAttribute( name );
if( attribute == null )
throw new XException( "no attribute known with name: " + name );
return attribute.getBoolean();
} | 1 |
public void visit_putstatic_nowb(final Instruction inst) {
final Type type = ((MemberRef) inst.operand()).nameAndType().type();
stackHeight -= type.stackHeight();
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
@EventHandler(priority = EventPriority.LOW)
public void InventoryClick(InventoryClickEvent event)
{
if(!event.isCancelled())
{
HumanEntity ent = event.getWhoClicked();
if(ent instanceof Player)
{
Inventory inv = event.getInventory();
if(inv instanceof AnvilInventory)
{
Inventory... | 9 |
private void writeOutputMatrices() throws Exception {
/* First read the original matrix dimensions */
BipartiteGraphInfo graphInfo = getGraphInfo();
int numLeft = graphInfo.getNumLeft();
int numRight = graphInfo.getNumRight();
VertexIdTranslate vertexIdTranslate =
... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final StreamRolledBack other = (StreamRolledBack) obj;
... | 5 |
public static String[] readSavedUsernames(File technicPath) {
byte[] mcHash = null;
String mcPass = "";
String mcUser = "";
String[] loginData = new String[2];
String[] dummyArray = { "", "", "" };
try {
File lastLogin = technicPath;
if (!lastLogin.exist... | 6 |
private static void initMacApplicationInstance() {
if(!isRunningOnMac()) return;
//if we already have initialized these then just return
if(macAdapterClass != null && macAppListenerInterface !=null &&
macAppEventClass != null && macAdapterInstance != null) {
return;
... | 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.