text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void newPacket(DataPacket packet) {
if(monitor != null || client != null) {
if(packet.getData().length > 0)
System.out.println(packet.getSource() + "-" + new String(packet.getData()));
if (packet.isKeepAlive()) {
this.monitor.messageReceived(packet);
}
else if (packet.isRouting()) {... | 5 |
@BeforeTest
public void setup() {
addressBookData = "src/test/resources/address_book.csv";
data = Data.getDataAsList(addressBookData);
addressBook = new AddressBook(data);
} | 0 |
private void setConfigs(Matrix new_m, int[] start, int[] vector, int[] start_vector) {
assert start.length == 2;
assert vector.length == 2;
assert start_vector.length == 2;
m = new_m;
starting_point[0] = (start[0] < 0) ? m.width-start[0] : start[0];
star... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node<?> other = (Node<?>) obj;
if (data == null) {
if (other.data != null... | 8 |
public static boolean isMuted(String player){
if (player == null) return false;
else {
Double mute = config.getDouble("mute.".concat(player.toLowerCase()).concat(".time"), 0);
if (mute == -1){
return true;
} else if (mute == 0){
... | 7 |
public void copyResource(DocPath resource, boolean overwrite, boolean replaceNewLine) {
if (exists() && !overwrite)
return;
try {
InputStream in = Configuration.class.getResourceAsStream(resource.getPath());
if (in == null)
return;
Output... | 8 |
static final boolean method2510(IndexLoader class45,
Class348_Sub16_Sub3 class348_sub16_sub3,
IndexLoader class45_5_, boolean bool,
Class279 class279, IndexLoader class45_6_) {
try {
Class318_Sub1_Sub4.aClass279_8764 = class279;
Class98.aClass348_Sub16_Sub3_1564 = class348_sub16_sub3;... | 8 |
public int minusDILookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + (this.unsta... | 4 |
public void onAction(String binding, boolean isPressed, float tpf) {
if (binding.equals(KeyMapper.MOVE_LEFT)) {
left = isPressed;
} else if (binding.equals(KeyMapper.MOVE_RIGHT)) {
right = isPressed;
} else if (binding.equals(KeyMapper.MOVE_FORWARD)) {
up = i... | 6 |
public static Program parseASM(String text, String defaultLabel) throws ParserException{
// break into lines
String[] lines = text.split("\n");
// Create an alias map to keep track of redundant labels
AliasMap aliasMap = new AliasMap();
// Create a new program
Program prog = new Program();
// Cre... | 8 |
public static List<Edge> dijkstraShortestPath(Graph g, int sourceVertex, int destinationVertex) {
Set<Integer> mould = new HashSet<>();
Set<Integer> universe = new HashSet<>();
universe.addAll(g.getAllVertex());
Map<Integer,List<Edge>> shortestPath = new HashMap<>();
final Map<I... | 8 |
private void generateCallMethod(ClassFileWriter cfw)
{
cfw.startMethod("call",
"(Lorg/mozilla/javascript/Context;" +
"Lorg/mozilla/javascript/Scriptable;" +
"Lorg/mozilla/javascript/Scriptable;" +
"[Ljava/lang/Ob... | 8 |
public static boolean propertyEqualsAsInt(PropertyContainer container, String key, int test_value) {
if (container != null) {
try {
int value = getPropertyAsInt(container, key);
return value == test_value;
} catch (NullPointerException npe) {
return false;
}
} else {
throw new IllegalArgumen... | 2 |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onDropLockedItemOnDeath(PlayerDeathEvent event) {
if (event.getEntity().getWorld().isGameRule("keepInventory")) {
return;
}
final Player player = event.getEntity();
if (player.hasPermission... | 6 |
public HashMap<String, Vector<Vector<Integer>>> generateSocaialFeature(String fileName){
String[] handPickRelevantUser = null;
if(fileName.equalsIgnoreCase("NUS1")){
handPickRelevantUser = new String[] { "NUSingapore",
"NUSLibraries", "nusmba", "NUS_MENA", "NUSCFA", "nusosa",
"yalenus", "NUSHistSoc",... | 7 |
@Override
public void addMessageToDB() {
try {
String statement = new String("INSERT INTO " + DBTable +
" (uid1, uid2, time, isConfirmed, isRejected) VALUES (?, ?, NOW(), ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, fromUser);
stmt.setInt(2, toUser);... | 1 |
private void moveElevator() {
if ((elevator.wasTargetOfLastCollision()&&elevatorCountdown--<=0)||
(elevatorPosition!=-90f&&elevatorPosition!=-180f)) {
float tempElevator=elevatorPosition+elevatorOffset;
float tempOffset=elevatorOffset;
if (tempElevator<-180f) {
... | 6 |
public void writeToFile() throws IOException {
String path = "C:\\Users\\lenovo\\Desktop\\1.txt";
File f = new File(path);
if (f.exists()) {
f.delete();
f = new File(path);
}
if (f.createNewFile()) {
BufferedWriter output = new BufferedWriter(new FileWriter(f));
while (current != null) {
Sy... | 3 |
public static int searchInsert(int[] A, int target) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int ss=0, ee=A.length-1;
int middle;
while(ss<=ee) {
middle=(ss+ee)/2;
if(A[middle]==target) return middle;
el... | 3 |
public static List<TradFile> readTransitive(InputStream in) throws FileNotFoundException{
List<TradFile> list=new ArrayList<>();
Scanner scanner=new Scanner(in);
TradFile tFile=null;
while(scanner.hasNextLine()){
String line=scanner.nextLine();
if(line.startsWith(FILE_DELIMITER)){
i... | 8 |
@Override
public void executeInternal(int minValue) {
seqUnbounded(new EflTextSegment(Move.A)); // player mon uses attack
// System.out.println("EflHitMetricSegment: size=" + sb.size());
seq(new CheckMetricSegment(new EflCheckMoveDamage(isCrit, effectMiss, 0, minDamage, maxDamage, false),GREATER_EQUAL, minDamag... | 5 |
public boolean isBalanced(String input){
Stack<Character> stack = new Stack<Character>();
for(int i=0;i<input.length();i++){
// push
if(LEFT_BRACES.indexOf(input.charAt(i) ) != -1){
stack.push(input.charAt(i));
}
// pop & validate
else{
Character lastElement = stack.pop();
if( lastElem... | 9 |
public int deserialize(BinarySearchTree<String, String, String> tree) {
Properties prop = new Properties();
InputStream istream = getClass().getClassLoader().getResourceAsStream("com/file/resources/additionalsearchtree.properties");
List<BinaryNode<String, String,String>> li = null;
try {
... | 6 |
public DbScoreboard() {
try {
Class.forName("org.sqlite.JDBC");
ensureStructure();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} | 1 |
@Override
public String toString(){
return "id= "+this.getId()+", " +this.getName()+"\n"+
getTime()+"\n"+
"Ребро: "+this.getHig()+"\n"+
"Сумма рёбер: "+this.getSum()+"\n"+
"Длина диагонали: "+this.getDiag()+"\n"+
"S=: "+this.getArea()+
" V=: "+this.getVolume()+"\n"... | 0 |
public Key min() {
if (isEmpty())
throw new java.util.NoSuchElementException();
return pq[1];
} | 1 |
@Override
public void createPreview(JTextArea ContentBox) {
String nLine = String.format("%n");
ContentBox.setText("");
boolean toolsInitFlag = false;
boolean pointsFlag = false;
for (int i = 0; i < fileLength; i++) {
if (tools_init[i] != null) {
if (!toolsInitFlag) {
toolsInitFlag = true;
C... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransactionEntity)) return false;
TransactionEntity that = (TransactionEntity) o;
if (identificationCode != that.identificationCode) return false;
if (name != null ? !name.equals(that... | 5 |
private void parseRegex(String regex) //a-z, ^0, A-Z
{
int strLen = regex.length();
if(regex.startsWith("^")) //is a not
{
for(int i = 1; i < strLen; i++)
{
if(regex.length() > i + 2 && regex.charAt(i+1) == '-') //fits a-z pattern
{
for(int j = regex.charAt(i); j <= regex.charAt(i+2); j++)... | 9 |
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
... | 3 |
int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look until FREE slot or we start to loop
... | 9 |
public PanelOptions() {
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
lblGeneration = new JLabel("Génération #0,00");
content.add(lblGeneration);
content.add(new JLabel());
content.add(new JLabel("Algorithme utilisé"));
... | 3 |
@Override
public String toString() {
String toString = "[\n";
for (Rule rule : this.rules) {
toString += rule.toString() + "\n";
}
toString += "]";
return toString;
} | 1 |
public static List<Zaposlenik> dajZaposlenike(String pretraga)
{
Session session = HibernateUtil.getSessionFactory().openSession();
Query q = session.createQuery("from " + Zaposlenik.class.getName());
List<Zaposlenik> sviZaposlenici = (List<Zaposlenik>)q.list();
List<Zaposlenik> zaposlenici = new ArrayList<Zap... | 3 |
private void createPanelStructure() {
JPanel mainPanel = new JPanel();
//Set main panel layout
mainPanel.setLayout(gridBagLayout);
GridBagConstraints constraints = new GridBagConstraints();
//Add groupboxes
equationParametersPanel.setBorder(BorderFactory.createTitledBord... | 0 |
public void validate(){
if( key == null ){
throw new IllegalStateException( "key is null" );
}
} | 1 |
@Test
public void test3() {
System.out.println("Test avec l'init avec 2 arguments et tous les états possibles");
System.out.println("Tests de couverture des post-conditions d'init");
for(BlocType b : BlocType.values()) {
for(PowerUpType p : PowerUpType.values()) {
bloc3.init(b,p);
assertTrue("type ini... | 4 |
@Test
public void testBatchBuy() throws EasyPostException, InterruptedException {
List<Map<String, Object>> shipments = new ArrayList<Map<String, Object>>();
Map<String, Object> shipmentMap = new HashMap<String, Object>();
shipmentMap.put("to_address", defaultToAddress);
shipmentMap.put("from_address"... | 4 |
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
int index = estrategyT.getSelectedRow();
if(index>=0){
String nombre = (String)estrategyT.getModel().getValueAt(index,0);
for(int i=0;i<contenedorEstrategia.ge... | 4 |
private ArrayList<CardPattern> hasBomb(ArrayList<Card> cards){
ArrayList<CardPattern> bombCardPatterns = new ArrayList<CardPattern>();
CardPatternFactory factory = new CardPatternFactory();
Collections.sort(cards);
int i=0;
int sameCardsCounter=0;
int size = cards.size();
int value=0;
while(i<size){
... | 8 |
public void EliminaMedio (int Posicion)
{
if ( VaciaLista())
System.out.println( "Nada");
else
{
NodosProcesos Aux =null;
NodosProcesos Actual = PrimerNodo;
int i =1;
while (( i != Posicion) & (Actual.siguiente != PrimerNodo))
{
i++;
Aux =Actua... | 4 |
private int readValidityPeriodInt()
{
// this will convert the VP to #MINUTES
int validity = readByte();
int minutes = 0;
if ((validity > 0) && (validity <= 143))
{
// groups of 5 min
minutes = (validity + 1) * 5;
}
else if ((validity > 143) && (validity <= 167))
{
// groups of 30 min + 12 hrs... | 8 |
protected void setBufferManager( BufMgr mgrArg ) {
mgr = mgrArg;
int numBuffers = mgr.getNumBuffers();
// These are the C++ code which we ignored
//char *Sh_StateArr = MINIBASE_SHMEM->malloc((numBuffers * sizeof(STATE)));
//state_bit = new(Sh_StateArr) STATE[numBuffers];
for ( int i... | 1 |
private void init() {
for (int i = 0; i < CAPACITY; i++) {
arr[i] = null;
}
} | 1 |
private boolean empate(int numero1,int numero2){
if(numero1 == numero2){
return true;
}else{
return false;
}
} | 1 |
public int edmons_karp(int s, int t) {
int u, e;
this.s = s;
mf = 0;
Arrays.fill(p, -1);
while (true) {
f = 0;
Queue<Integer> q = new LinkedList<Integer>();
int[] dist = new int[V];
Arrays.fill(dist, INF);
dist[s] = 0;
q.offer(s);
Arrays.fill(p, -1);
while (!q.isEmpty()... | 7 |
@Override public void layoutContainer(Container parent) {
int cardOverflow = fieldCardComponents.size() % 4;
int cardsPerSide = fieldCardComponents.size() / 4;
boolean even = true;
Dimension point = new Dimension();
//calculates where to start drawing the the field cards
if(cardOverflow != 0) {
point.wi... | 7 |
public static void saveConfig() throws IOException {
File current = new File(System.getProperty("user.dir") + "/config");
if(current.exists()) {
current.delete();
}
current.createNewFile();
BufferedWriter writer = new BufferedWriter(new FileWriter(current));
writer.write("<AUDIO>");
writer.newLin... | 2 |
public void tick() {
ticksleft--;
if (pressedUp) { pressedUp = false; currentblock.tryRotate(); }
if (pressedRight) { pressedRight = false; currentblock.tryMoveRight(); }
if (pressedLeft) { pressedLeft = false; currentblock.tryMoveLeft(); }
if (ticksleft <= 0) {
if (currentblock == null) {
... | 9 |
protected String InferLangFromReferralUrl(HttpServletRequest httpRequest, String parseLangQueryParams)
{
// Examine the referer header that came with this request to see if we can infer the user's language.
// If we find a query string paramater that matches the list provided, return the content of that... | 6 |
private void volume_slide() {
int up, down;
up = ( volume_slide_param & 0xF0 ) >> 4;
down = volume_slide_param & 0x0F;
if( down == 0x0F && up > 0 ) {
/* Fine slide up.*/
if( effect_tick == 0 ) {
set_volume( volume + up );
}
} else if( up == 0x0F && down > 0 ) {
/* Fine slide down.*/
if( eff... | 8 |
public void idToValue() {
int valueList[] = { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11, 2,
3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11, 2, 3, 4, 5, 6, 7, 8,
9, 10, 10, 10, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 };
for (int i = 0; i < 52; i++) {
if (id == i) {
value = valueList[i];
brea... | 2 |
public long[] decodeLongs() {
long[] res = new long[decodeInt()];
for (int i = 0; i < res.length; i++) {
res[i] = decodeLong();
}
return res;
} | 1 |
public double calculateDistance() throws IllegalStateException,
ArithmeticException {
double U1, U2, w, sigma, ssig, csig, salp, c2alp, c2sigm;
double u, A, B, C, dsig, b;
double lambda, dlam = 0.0, lastdlam = 0.0;
double p, q;
int nIters = 0, nMaxIters = 10;
double a = ellipsoid.getSemiMajorAxis();
d... | 7 |
boolean isObjectAlreadyInDB() {
return objectAlreadyInDB;
}//isObjectAlreadyInDB | 0 |
@Override
public void deleteMedicine(MedicineDTO medicine) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(medicine);
session.getTransaction().com... | 3 |
private synchronized void deuce (String v) throws JMSException {
QueueConnection qc =null;
QueueSession qs =null;
///prova mess
try {
qc = qcf.createQueueConnection();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
qs = qc.createQueueSession... | 3 |
private void
build_function_structure()
{
if(log_level >= 4) log.log(4, key, "build_function_structure called.", "\n");
TreeMap<Integer,Variable> temp = new TreeMap<>();
HashMap<Integer,Variable> helper;
int count = 0;
for (... | 5 |
public List<ItemType> getAllRandomItems(){
List<ItemType> itemsToReturn = new ArrayList<>();
for(ItemType item : items.keySet()){
double d = new Random().nextDouble();
if(d < items.get(item)){
itemsToReturn.add(item);
}
}
for(ExclusiveItems exclusive : exclusiveItems){
ItemType exclusiveItem ... | 4 |
public void testConstructor_RI_RP8() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1);
try {
new MutableInterval(dt, dur);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
@Override
public void execute() {
if (Game.getClientState() != Game.INDEX_MAP_LOADED) {
ItemCombiner.stop = 1000;
}
if (Game.getClientState() != Game.INDEX_MAP_LOADED && ItemCombiner.stop == 1000) {
ItemCombiner.stop = 50;
}
if (ItemCombiner.client != Bot.client()) {
WidgetCache.purge();
Bot.... | 5 |
public void addCard(String s) {
// Correspondance entier-carte : 0 = chevalier ; 1 = monopole ; 2 = route ; 3 = decouverte ; 4 = victoire.
if (s.equals("chevalier")) cards[0]++;
else if (s.equals("monopole")) cards[1]++;
else if (s.equals("route")) cards[2]++;
else if (s.equals("decouverte")) cards[3]++;
e... | 5 |
public String log() throws Exception
{
ArrayList<LogItem> toLog = new ArrayList<LogItem>(data.length);
LogItem toAdd;
for (int i = 0; i < data.length; ++i)
{
if (dataSwitch[i])
{
toAdd = new LogItem();
toAdd.barID = AutoAppro.products.get(data[i].supplierID).barID;
toAdd.price = data[i].price... | 2 |
private void setMatrixArray(int[] readBuffer) {
//1st report
if (readBuffer[0] == 0x1a) {
oldMatrix[4] = matrix[4];
oldMatrix[5] = matrix[5];
oldMatrix[6] = matrix[6];
oldMatrix[7] = matrix[7];
/*deb*/
System.out.println("setting m... | 8 |
@Override
public void handleMessages(Inbox inbox) {
// TODO Auto-generated method stub
while (inbox.hasNext()) {
Message msg = inbox.next();
if (msg instanceof PackHelloOldBetHop) {
PackHelloOldBetHop a = (PackHelloOldBetHop) msg;
handlePackHello(a);
}else if (msg instanceof PackReplyOldBetHop... | 3 |
public Spit(String dir, TileMap tm){
super(tm);
if(dir.equals("right")){
facingRight = true;
facingUp = false;
facingDown = false;
} else if(dir.equals("up")){
facingRight = false;
facingUp = true;
facingDown = false;
} else if(dir.equals("down")){
facingRight = false;
facingUp = fals... | 8 |
public void storeSMS(HttpServletRequest req)
{
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
String msg="";
String disease, age, location, riskgroup, vaccine;
disease=age=location=riskgroup=vaccine=null;
Entity en=new Entity("inboundSMS");
en.setProperty("number", req.get... | 7 |
public static String display(Object object) {
if (object == null) {
return null;
}
try {
// Invoke toString if declared in the class. If not found, the
// NoSuchMethodException is caught and handled
object.getClass().getDeclaredMethod("toString");
return object.toString();
} catch (NoSuchMethod... | 9 |
private String makeCode(){
String c=((ComboText)command.getSelectedItem()).getValue();
if(c.equals("MAKE")){
String code=objName.getText()+"=addons.canvas2d("+makeW.getValue()+","+makeH.getValue()+");\n";
code+=objName.getText()+".autoUpdate="+makeUpdate.isSelected()+"\n";
... | 9 |
public static Map<String, Vector<String>> getCuratedCategories() throws PluginNotFoundException {
final Map<String, Vector<String>> identities = new HashMap<String, Vector<String>>();
final SimpleFieldSet sfs = new SimpleFieldSet(true);
sfs.putOverwrite("Message", "GetOwnIdentities");
SyncPluginTalker spt = ... | 9 |
public ArrayList<Integer> getValidMoves(int player) {
ArrayList<Integer> playerPieces = findPlayerPieces(player);
ArrayList<Integer> legalMoves = new ArrayList<Integer>();
for (Integer playerPiece : playerPieces)
legalMoves = findLegalMoves(playerPiece, player, legalMoves);
C... | 1 |
public int getValidRxCount() {
return validRxPackets;
} | 0 |
public void setFullScreen(DisplayMode displayMode) {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setIgnoreRepaint(true);
frame.setResizable(false);
device.setFullScreenWindow(frame);
... | 5 |
@Override
public void keyReleased(KeyEvent e) {
//only checks for user input if the game has started
if(gameFrame.gameStarted()){
// if the user presses W
if (KeyEvent.getKeyText(e.getKeyCode()).equals("W")) {
// attempt to move the player forwards
player.moveForward();
}
else if (KeyEven... | 4 |
private Result _evaluate(EvaluationCtx context) {
// evaluate
Result result = combiningAlg.combine(context, parameters,
childElements);
// if we have no obligations, we're done
if (obligations.size() == 0)
return result;
... | 5 |
public static Iterator<Position> get8NeighborhoodIterator(Position center) {
ArrayList<Position> list = new ArrayList<Position>();
int row = center.getRow(); int col = center.getColumn();
int r,c;
for (int dr = -1; dr <= +1; dr++) {
for (int dc = -1; dc <= +1; dc++) {
r = row+dr; c = col+d... | 8 |
@WebMethod(operationName = "ReadProduct")
public ArrayList<Product> ReadProduct(@WebParam(name = "prod_id") String prod_id) {
Product prod = new Product();
ArrayList<Product> prods = new ArrayList<Product>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
... | 3 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (hashCode() == o.hashCode()) return true;
Asteroid asteroid = (Asteroid) o;
if (dangerousToMankind != asteroid.dangerousToMankind) return fal... | 7 |
public static boolean argumentMatchesListHelperP(Stella_Object argument, List theList) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(argument);
if (Surrogate.subtypeOfP(testValue000, Units.SGT_LOGIC_PATTERN_VARIABLE)) {
{ PatternVariable argument000 = ((PatternVariable)(argument));
... | 8 |
private void activate() {
if (isActive())
throw new IllegalArgumentException("Forcefield was already active, something went wrong");
this.active = true;
for (Element e : getGrid().getElementsOnPosition(getGrid().getElementPosition(this)))
collideWith(e);
} | 2 |
public void mightyMode(boolean isOn){
this.player= new MightyPacman(this.player.getX(), this.player.getY(), this, this.player.getFacing(), this.player.getSavedDir());
this.playerStateTimer.stop();
this.playerStateTimer.start();
for (int i=0; i < 4; i++)
if (this.ghosts[i].getIsAlive())
if (i%2 == 0)
... | 3 |
public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... | 8 |
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://... | 6 |
@Override
public void option() {
int cores = Runtime.getRuntime().availableProcessors();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
if (this.operand.equals("random"))
{
Random r = new Random(new Date().getTime());
int tasks = r.nextInt(15) + 1;
Config.getInstance().th... | 8 |
public double[] meanColumns() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
double[] result = sumColumns();
for (int c = 0; c < nCols; c++) {
result[c] = result[c] / nRows;
}
return result;
} | 1 |
public LinkedList<FaultsStore> getFaults(){
LinkedList<FaultsStore> psl = new LinkedList<FaultsStore>();
Connection Conn;
FaultsStore ps = null;
ResultSet rs = null;
try {
Conn = _ds.getConnection();
} catch (Exception et) {
System.out.println("No Connection in Faults Model");
return null;
}
... | 7 |
private void printString(TypeList list1, TypeList list2) {
String inputedType = list1.type();
if (list2 != null) {
inputedType = inputedType + "/" + list2.type();
TypeNode current2 = list2.head();
while (current2 != null) {
list1.modType(... | 7 |
public static void main(String args[]){
System.out.println("The value of 12 is");
R1Dot9IsOdd r=new R1Dot9IsOdd();
if(r.isOdd(12)){
System.out.println("Odd");
}else{
System.out.println("Even");
}
} | 1 |
private boolean isFourCardBadugi()
{
if (isColour() || isStreet() || isThree() || isPair())
{
return false;
}
else
{
return true;
}
} | 4 |
public boolean postMortem(PostMortem pm) {
JSONzip that = (JSONzip) pm;
return this.namehuff.postMortem(that.namehuff)
&& this.namekeep.postMortem(that.namekeep)
&& this.stringkeep.postMortem(that.stringkeep)
&& this.substringhuff.postMortem(that.substring... | 5 |
public void reinit(){
switch(loadingCount){
case 0:
updateMapProgress(0.10f, "Reloading");
break;
case 1:
this.setPaused(true); // ensure it's paused
//stateManager = new AppStateManager(this); bulletAppState.cleanup();
initStates();
updateMapProgress(0.10f, "Create Ship");
break;
c... | 9 |
@Override
public void delScript(ScriptingEngine S)
{
if(scripts!=null)
{
if(scripts.remove(S))
{
if(scripts.size()==0)
scripts=new SVector<ScriptingEngine>(1);
if(((behaviors==null)||(behaviors.size()==0))&&((scripts==null)||(scripts.size()==0)))
CMLib.threads().deleteTick(this,Tickable.TI... | 7 |
public void checkHit(){
setBounds((int)x, (int)y, 20, 20);
for(Enemy enemy : board.getEnemies()){
if(this.intersects(enemy) && enemy.inGame()){
if(ammoAbility != null && ammoAbility.equals("glue")) enemy.slowDownEnemy();
enemy.setLives(damage);
// add splash damage to missiles
if(ammoType.eq... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Rectangle other = (Rectangle) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) !... | 7 |
@Override
public String getCity() {
return super.getCity();
} | 0 |
boolean isAttackPlaceDiagonallyBelowRightNotHarming(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) {
int positionRightBelow = 1;
while (attackPlacesOnTheRight > 0) {
if (isPossibleToPlaceDiagRightBelow(boardElements.length, position, dimension, positionRightB... | 3 |
public boolean setInputFormat(Instances instanceInfo) throws Exception {
if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) {
throw new IllegalArgumentException("TimeSeriesDelta: Need to fill in missing values " +
"using appropriate option when class inde... | 7 |
public PassengerCarChoice(Frame owner, DepartingTrain theTrain) {
super(owner, true);
this.theTrain = theTrain;
setBounds(100, 100, 270, 203);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
conte... | 3 |
private static String write(int c, String l) {
switch (c) {
case 0:
return "NAME:" + NAME;
case 1:
return "MONEY:" + MONEY;
case 2:
return "POS:" + POS;
case 3:
return "MAP:" + MAP;
case 4:
return "GENDER:" + GENDER;
case 5:
return "MUSIC:" + MUSIC;
}
return null;
} | 6 |
public static CategoryDataset timeCreateDataset2(String t0, String t1, String t2, String t3, Map<String,Integer> timemap, String user_name)
{
DefaultCategoryDataset dataset=new DefaultCategoryDataset();
//System.out.println(t0+t1+t2+t3);
int a0 = Integer.parseInt(t0);
int a1 = Intege... | 6 |
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.