text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void showTemporalProjects(String queryString) {
PanelHelper.cleanPanel(spelprojectHolderPanel);
ArrayList<String> tempal = new ArrayList<>();
ArrayList<Spelprojekt> al = new ArrayList<>();
Date now = new Date(); //fetch what the date is right now
String nowdate = new java... | 4 |
public int getRXAxisValue() {
if (rxaxis == -1) {
return 127;
}
return getAxisValue(rxaxis);
} | 1 |
public String extractLastName(String fullName) {
String lastName="";
String msg="";
//String temp="";
//String pattern = "[a-zA-Z]"+ " " + "[a-zA-Z]";
boolean nameRight=false;
int j=0;
do{
if(fullName==null||fullName.length()==0){
... | 8 |
public void run () {
//Guarda tiempo actual del sistema
lonTiempoActual = System.currentTimeMillis();
// se realiza el ciclo del juego en este caso nunca termina
while (true) {
/* mientras dure el juego, se actualizan posiciones de jugadores
se checa s... | 5 |
Object lock(Ref ref){
//can't upgrade readLock, so release it
releaseIfEnsured(ref);
boolean unlocked = true;
try
{
tryWriteLock(ref);
unlocked = false;
if(ref.tvals != null && ref.tvals.point > readPoint)
throw retryex;
Info refinfo = ref.tinfo;
//write lock conflict
if(refinfo != null && refin... | 8 |
public static void main(String args[]) {
System.out.println("Number\tPossible Combinations");
for (int x = 1; x <= 18; x++) {
int count = 0;
for (int k = 1; k <= 6; k++) {
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= 6; j++) {
if (k + i + j == x)
count++;
}
}
}
Syst... | 5 |
public int verifyNumberOfPlayersOnBoard(){
int players = 0;
Tile currentJTile = topTile;
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
if(currentKTile.playerOnTile != null){
players++;
}
currentKTile = currentKTile.rightDown;
}
... | 3 |
public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for (String ln;(ln=in.readLine())!=null;) {
StringTokenizer st=new StringTokenizer(ln);
int N=parseInt(st.nextToken()),M=parseInt(st.nextT... | 8 |
public Category getCategory(String naam){
for (Category cat : categories) {
if ( cat.naam.equals(naam) ){
return cat;
}
}
Category returnCat = new Category(naam);
categories.add(returnCat);
return returnCat;
} | 2 |
private Expr expr() {
Expr res, nextTerm; res = term();
while (theTokenizer.ttype == '+' || theTokenizer.ttype == '-') {
char op = (char) theTokenizer.ttype;
theTokenizer.next();
nextTerm = term();
if (op == '+') {
res = new Add(res,nextTerm);
} else {
res = new Sub(res,nextTerm);
}
}
... | 3 |
private String bidForAuction() {
if (user.isOnline()) {
int auctionID = 0;
double amount = 0.0;
if (stringParts.length < 3) {
return "Error: Please enter the bid- Command like this: " +
"!bid <auction-id> <amount>";
}
try {
auctionID = Integer.parseInt(stringParts[1]);
amount = Do... | 5 |
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
sb = new StringBuilder( );
int N = Integer.parseInt(in.readLine());
in.readLine();
for (int i = 0; i < N; i++) {
score = new TreeMap<Integer,int[]>();
solved = new TreeMap<... | 9 |
public void main(String sourceDir, String destDir)
{
try {
String currentdir = plugin.minecraft_folder;
// File (or directory) to be moved
File source = new File(currentdir + "/" + sourceDir);
// Destination directory
File dest = new File(currentdir + "/" + destDir);
if (source.exists()){
... | 3 |
public static double maxProfitJor(double[] prices) {
double percentOriginal = 1;
double lowestCurrent = prices[0];
double highestCurrent = prices[0];
for(int i=0; i < prices.length; i++) {
if (prices[i] > highestCurrent && i < prices.length - 1) {
highestCurre... | 5 |
public Population tournamentSelection(Population pop, int outSize, int tourSize){
Individual [] subset = new Individual[outSize];
int popSize = pop.size();
int [] indexes = new int[tourSize];
Set<Integer> indexesB = new HashSet<Integer>();
int outCount = 0;
while (outCount<outSi... | 4 |
public synchronized TrackedTorrent announce(Torrent newTorrent) {
TrackedTorrent torrent = this.torrents.get(newTorrent.getHexInfoHash());
if (torrent != null) {
logger.warn("Tracker already announced torrent for '" +
torrent.getName() + "' with hash " +
torrent.getHexInfoHash() + ".");
return torr... | 1 |
private boolean addModeToSet(final String modeName, Map<String, Set<String>> modeSets, String[] modeToAdd) {
if (null == modeName || "".equals(modeName.trim())) return false;
boolean isModified = false;
String o = modeName.trim().toUpperCase();
Set<String> modeSet = modeSets.get(o);
if (null == modeSet) {
... | 7 |
public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... | 3 |
private void updateAlt() {
mAltCount = mCount;
mAltModifier = mModifier;
if (EXTRA_DICE_FROM_MODIFIERS) {
int average = (mSides + 1) / 2;
if ((mSides & 1) == 1) {
// Odd number of sides, so average is a whole number
mAltCount += mAltModifier / average;
mAltModifier %= average;
} else {
//... | 4 |
@Override
public String toString()
{
return "&markers=color:blue%7Clabel:"+Integer.toString(id)+"%7C"+Double.toString(latitude)+","+Double.toString(longtitude);
} | 0 |
public Color getTopDividerColor() {
return mTopDividerColor == null ? mOwner.getDividerColor() : mTopDividerColor;
} | 1 |
public static void main(String[] args) {
/* program to print the pattern
55555
4444
333
22
1
*/
for (int i=5;i>=0;i--)
{
for (int j=i;j>=0;j--)
System.out.print(i);
System.out.println("");
}} | 2 |
public void repaintView() {
repaint();
if (mHeaderPanel != null) {
mHeaderPanel.repaint();
}
} | 1 |
@Override
public List<String> getGroups() {
return (LinkedList<String>) groups.clone();
} | 0 |
private void anothing()
{
System.out.println("功能B");
} | 0 |
private synchronized void schedule() {
if (!mPending && isDisplayable()) {
mPending = true;
Tasks.scheduleOnUIThread(this, 1, TimeUnit.SECONDS, this);
}
} | 2 |
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... | 6 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(affected instanceof Room)
{
final Room R=(Room)affected;
if(isBlightable(R.myResource()))
R.setResource(RawMaterial.RESOURCE_SAND);
for(int i=0;i<R... | 7 |
public void createCoupon(String cou_name,String cou_file, int quantity){
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
try{
conn = getConnection();
sql = "insert into coupon(cou_num,cou_name,cou_usage,cou_date.cou_file) values" +
"(cou_num_seq.nextval... | 8 |
private void expandArrayCapacityBy(int number) {
E[] temparr = (E[]) new Object[array.length + number];
System.arraycopy(array, 0, temparr, 0, (number > 0) ? array.length
: array.length + number);
array = temparr;
} | 1 |
private boolean getDataBlock(int leafItemIndex) {
// check for valid data block
if (leafItemIndex >= leafHitList.size())
return false;
// Perform a block read for indexed leaf item
leafHitItem = leafHitList.get(leafItemIndex);
// get the chromosome names associated... | 2 |
public int getBumoncode() {
return this.bumoncode;
} | 0 |
public void closeSocket()
{
try
{
if
(
this.isaMc != null
&& this.ms != null
&& ! this.ms.isClosed()
)
this.ms.leaveGroup(isaMc, EzimNetwork.localNI);
}
catch(Exception e)
{
EzimLogger.getInstance().severe(e.getMessage(), e);
}
try
{
if (this.ms != null && ! this.ms.isCl... | 7 |
@Override
public void emitCode(GluonOutput code) {
factor.emitCode(code);
for (int i=0; i<factors.size(); i++) {
code.code("PUSH EAX");
factors.get(i).emitCode(code);
switch (ops.get(i)) {
case MULTIPLY:
code.code("POP EBX");
code.code("IMUL EAX,EBX");
break;
case DIVIDE:
code.... | 3 |
public static int Cardinality(Object obj, Collection coll){
if(coll == null){
throw new NullPointerException();
}
if(obj == null){
throw new NullPointerException();
}
for(Object o : coll){
if(o.equals(obj)){
total++;
}
}
return total;
} | 4 |
public void removeCleanup(int start, int end){
// проверяет не нужно ли удалить схлопнувшиеся сегменты
Set<ASection> s = aDataMap.keySet();
Iterator<ASection> it = s.iterator ();
boolean foundCollapsed = false;
Vector <ASection> toRemove = new Vector <ASection>();
while(it.hasNext()){
ASection sect = it.next(... | 7 |
private void ensureStructure() {
try (Statement statement = openStatement()) {
ResultSet rs = statement.executeQuery("SELECT time FROM scores");
} catch (SQLException e) {
try {
Statement s = openStatement();
s.executeUpdate("CREATE TABLE scores(" +
"time INT)");
} catch (SQLExcep... | 2 |
void sendMessageToSocket (Message msg, DataOutputStream dos) throws IOException
{
int len = msg.data != null ? msg.data.length : 0;
if (isControlOpcode (msg.opcode) && len > 125)
throw new IOException ("payload for control packet too large");
if (msg.opcode <= 0 || msg.opcode > 0xf)
throw new IOExceptio... | 8 |
@EventHandler
public void WitchNausea(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.getWitchConfig().getDouble("Witch.Nausea.Dodg... | 6 |
private void moveMouse(final Gamepad gamepad, final double delta) {
final int MAX_SPEED = 1800;
Point mouse = MouseInfo.getPointerInfo().getLocation();
float x = gamepad.getStickRight().getValueX();
float y = gamepad.getStickRight().getValueY();
if (Math.abs(x) > 0.25) {
moveX += (delta * x * x * x * x ... | 6 |
public UserOperator stop() {
thisTimer.cancel();
run = false;
return this;
} | 0 |
final public void Class_tail() throws ParseException {
/*@bgen(jjtree) Class_tail */
SimpleNode jjtn000 = new SimpleNode(JJTCLASS_TAIL);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(END);
jj_consume_token(... | 1 |
private void isEqualToBoolean(final Object param, final Object value) {
if (value instanceof Boolean) {
if (!((Boolean) value).equals((Boolean) param)) {
throw new IllegalStateException("Booleans are not equal.");
}
} else {
throw new IllegalArgumentException();
}
} | 2 |
public String getstatetext(){
return state;
} | 0 |
public static boolean isNullOrEmpty(String value) {
return value == null || value.length() == 0;
} | 1 |
@Test
public void testParseInvalidPredicateName() throws Exception {
Parser parser = new Parser();
try {
parser.parsePredicate("father*of(P, C)");
fail("This predicate contains invalid characters in the name.");
} catch (ParseException ex) {
// Expected ex... | 1 |
private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
plugin.getLogger().log(Level.SEVERE, null, e);
}
}
} | 3 |
private void dbCheck(String dir){ //checks to see if the db has been created
File isdb = new File(dir +"\\myDB");
if (isdb.exists()){
if (DBRead.DBIntegrityCheck(countries)){
JOptionPane.showMessageDialog(null,"The Database appears to be damaged, please wait create a new one.",
... | 6 |
@Test
public void deletingFromEmptyListDoesntAffectSize() {
a.delete(v);
assertEquals(0, a.getSize());
for (int i = 0; i < 10; i++) {
a.delete(v);
}
assertEquals(0, a.getSize());
} | 1 |
private static List<Appointment> findWeeklyByDay(long uid, long day)
throws SQLException {
List<Appointment> aAppt = new ArrayList<Appointment>();
// select * from Appointment where frequency = $WEEKLY
// and startTime <= $(day + DateUtil.DAY_LENGTH)
// and lastDay >= $day
// and freqHelper = $freqHelper
... | 1 |
public void unregisterListeners( Plugin plugin )
{
for( Class< ? extends Event > eventClass : executors.keySet())
{
List< EventExecutor > keep = new ArrayList< EventExecutor >();
for( EventExecutor e : executors.get( eventClass ) )
{
if( e.getPlugin().getClass() == plugin.getClass() )
{
c... | 5 |
public static boolean marshalSalesResponse(com.adammargherio.xml.schemas.salesorder.Message m, boolean save) {
com.adammargherio.xml.schemas.standardresponse.Message response = new com.adammargherio.xml.schemas.standardresponse.Message();
//Fill message header contents
MessageHeader responseHea... | 7 |
public ShellLink setIconLocation(String s) {
if (s == null)
header.getLinkFlags().clearHasIconLocation();
else {
header.getLinkFlags().setHasIconLocation();
String t = resolveEnvVariables(s);
if (!Paths.get(t).isAbsolute())
s = Paths.get(s).toAbsolutePath().toString();
}
iconLocation = s;
ret... | 2 |
static private float[] subArray(final float[] array, final int offs, int len)
{
if (offs+len > array.length)
{
len = array.length-offs;
}
if (len < 0)
len = 0;
float[] subarray = new float[len];
for (int i=0; i<len; i++)
{
subarray[i] = array[offs+i];
}
return subarray;
} | 3 |
@Override
public Grid generateGrid() {
playerFactory.generate();
// Give the players some items to start
for (Player player : grid.getAllPlayersOnGrid()) {
LightGrenade item1 = new LightGrenade(player.getPosition());
this.addObservable(item1);
this.addObserver(item1);
player.addItemToInventory(item1... | 1 |
public Gui getGui() {
return new Gui() {
@Override
public void render(Graphics2D g2d, int width, int height) {
LinearGradientPaint gradient = new LinearGradientPaint(0, 0, 0, 100, new float[]{0,1}, new Color[]{new Color(0x666666),new Color(0x444444)});
g2d.setPaint(gradient);
g2d.fillRect(0, 0, width,... | 3 |
public void doPrint() {
List<String> nodes = this.graph.getVertexes();
for (String node : nodes) {
List<String> edges = this.graph.getIncident(node);
for (String edge : edges) {
if (this.graph.getSource(edge).equals(node)) {
System.out.format("%4s (%3s,%3s) %4s",
node,
this.graph.g... | 5 |
public Colony build(){
// player not set, get default
if(player == null){
player = game.getPlayer(defaultPlayer);
if(player == null){
throw new IllegalArgumentException("Default Player " + defaultPlayer + " not in game");
}
... | 7 |
public int getBurnDurationOfFuelBlock(int blockID)
{
int time = 0;
if(fuelBlocksGroupIDlist_Wool.contains(blockID))
{
time = Arctica.burnDuration_Wool;
}
else if(fuelBlocksGroupIDlist_CraftedWood.contains(blockID))
{
time = Arctica.burnDuration_CraftedWood;
... | 4 |
public static boolean hasStrongNode(Node node) {
try {
node.getNodeType();
} catch (Exception e) {
return true;
}
if (node.getNodeType() == Node.TEXT_NODE) {
return !node.getNodeValue().isEmpty();
}
if (node.getNodeName().equalsIgnoreCase("img")) {
return true;
}
... | 9 |
public static int delete(String sql, List<Param> params)throws SQLException{
C3p0Pool pool = C3p0Pool.getInstance();
Connection conn = pool.getConnection();
PreparedStatement statement = conn.prepareStatement(sql);
if(params!=null){
int i=1;
for(Param p:params){
if(p.getColumnType()==ColumnType.Date){... | 9 |
public static double findNthSortedArrays(int A[], int B[], int nth) {
int alen = A.length;
int blen = B.length;
int i = 0, j = 0;
while (i < alen && j < blen) {
if (1 == nth) {
return min(A[i], B[j]);
}
int nth1 = nth / 2;
int nth2 = nth - nth1;
nth1 = min(nth1, alen - i);
nth2 = min(nth2,... | 5 |
public void addPopup(int x, int y) {
JMenuItem item = new JMenuItem();
JPopupMenu menu = new JPopupMenu();
if(list.getSelectedValue() == null) {
item = new JMenuItem("Add");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
NewVariableEditor varEdit... | 2 |
@Override
public ForeignKey parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("FOREIGN KEY (");
int i = 0;
for(String lF : lFL) {
if(i > 0) {
sB.append(", ");
}else{
++i;
}
sB.append(lF);
}
sB.append(") \... | 7 |
public Student search(int id) throws UnknownStudent {
Student s = null;
boolean found = false;
int i = 0;
while (i < list.size() && !found) {
s = list.get(i);
if (s.getId() == id)
found = true;
i++;
}
if (!found) {
throw new UnknownStudent("No student with an id " + id
+ " in the Prom... | 4 |
@Test
public void deleteOneTest() {
final int n = 1_000;
IntArray arr = IntArray.empty();
for(int k = 0; k < n; k++) {
for(int i = 0; i < k; i++) {
final IntArray arr2 = arr.remove(i);
final Iterator<Integer> iter = arr2.iterator();
for(int j = 0; j < k - 1; j++) {
... | 4 |
@Override
public void draw(Graphics page)
{
BulletImage.drawImage(page, xLocation, yLocation);//Draws the plane on the component
//Draws the collision Border
if(this.getBorderVisibility())
{
drawCollisionBorder(page,xLocation,yLocation,BulletImage.getWidth(),BulletImage.getHeight());
}
} | 1 |
public MapObject findNextTargetObject() {
for (Robot robot : current_room.getRobots()) {
if (robot.isVisible() && shouldTargetObject(robot) &&
(!bound_pyro.isCloaked() || Math.random() < TARGET_ROBOT_WHEN_CLOAKED_PROB)) {
return robot;
}
}
for (Powerup powerup : current_roo... | 8 |
public static void main(String[] args){
try {
String name = "main";
int num_rand;
ArrayList<JvnObjectImpl> array = new ArrayList<JvnObjectImpl>();
//MonObjet o1 = new MonObjet("objet1");
//JvnObjectImpl shared_object_1 = (JvnObjectImpl) JvnServerImpl.jvnGetServer().jvnCreateObject(o1);
//JvnServerIm... | 6 |
private String[] getCombinations(String[] variables) {
ArrayList list = new ArrayList();
for (int k = 0; k < ((int) Math.pow(2, variables.length)); k++) {
String comb = pad(Integer.toBinaryString(k), variables.length);
list.add(getRepresentation(comb, variables));
}
return (String[]) list.toArray(new Stri... | 1 |
@Override
public void onPhase(PHASE phase, PHASE_STAGE stage) {
if (phase.equals(PHASE.CONTENT_SCRAPE)
&& stage.equals(PHASE_STAGE.COMPLETE) && canTerminate) {
logger.debug("Done scrapping. Deleting mapping");
// delete the mapping. We are done with the scrape
} else if (phase.equals(PHASE.PAGE_SCRAP... | 6 |
public Node getNext() {
Node node = current;
if (node == head) {
current = null;
return null;
} else {
current = node.next;
return node;
}
} | 1 |
private static boolean magicSquare(int[][] matrix) {
int n = matrix.length;
int nSquare = n * n;
int magicSum = (n * n * (n * n + 1) / 2) / n; // Distribution of first k
// = n * n natural
// numbers distributed
// among n rows/columns
int rowSum = 0, colSum = 0, firstD... | 9 |
public CheckerBoard(int size) {
boardSize = size;
checkersBoard = new char[boardSize][boardSize];
typeR = 'r';
typeB = 'b';
empty = '_';
typeRList = new LinkedList<Chip>();
typeBList = new LinkedList<Chip>();
for (int i = 0; i < boardSize; i++) {
... | 9 |
public void qSortMedianThree(int[] array, int left, int right){
if((right-left)<=0)
return;
if((right-left)==1){
if(array[left]>array[right])
swap(array, left, right);
}else{
int median = medianOf3(array, left, right);
int part = partIt(array, left, right, median);
qS... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Jogador other = (Jogador) obj;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return ... | 6 |
private void init(final String mapPath, final Properties props)
{
this.props = props;
// Hajo: walls for all squares of this map
if(props.get("walls") != null) {
walls = getIntegers(props, "walls", '#');
}
// Hajo: Floor for all squares of this map t... | 5 |
private void batchEstimateDataAndMemory(boolean useRuntimeMaxJvmHeap, String outputDir, int newRNBase, boolean outputDetailedDataflow) throws IOException {
File mDataOutputFile = new File(outputDir, "eDataMappers.txt");
File rDataOutputFile = new File(outputDir, "eDataReducers.txt");
// outputDir = /estimatedD... | 9 |
private void setup() {
dataFolder = main.getDataFolder();
accountFolder = new File(dataFolder.getPath() + "\\accounts");
transactionFolder = new File(dataFolder.getPath() + "\\transactions");
main.debug("Data folder: " + dataFolder.getPath());
main.debug("Account folder: " + acc... | 3 |
public Image(int width, int height) {
this.width = width;
this.height = height;
this.pixels = new int[this.width*this.height];
} | 0 |
public void setEmail(String email) {
this.email = email;
} | 0 |
public void buildDetail(String id, JPanel panel) {
if (getId().equals(id)) {
return;
}
TileType tileType = getSpecification().getTileType(id);
panel.setLayout(new MigLayout("wrap 4, gap 20"));
String movementCost = String.valueOf(tileType.getBasicMoveCost() / 3);
... | 8 |
public ItemTablePanel(Class<T> clazz, ItemSet<T> items) throws Exception {
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
this.model = new ItemTableModel(clazz, items, this);
this.table = new JTable(this.model);
this.table.setFillsViewportHeight(true);
int index =... | 7 |
public int getPreferredHeight(List<Column> columns) {
int preferredHeight = 0;
for (Column column : columns) {
int height = column.getRowCell(this).getPreferredHeight(this, column);
if (height > preferredHeight) {
preferredHeight = height;
}
}
return preferredHeight;
} | 2 |
private static void colorButtonByPercentChangeAfterEarningsReport(
CustomButton a, String dateInfo, String ticker) {
String[] dates = dateInfo.split(" ");
if (dates.length < 2) {
// System.out.println("\n\nARRAY IS SHORT : " + dateInfo + " --> "
// + Arrays.toString(dates));
return;
}
try {
l... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BankAccount other = (BankAccount) obj;
if (listeners == null) {
if (other.listeners != null)
return false;
} else if (!listeners.equals(... | 7 |
@Test(expected = BadNextValueException.class)
public void testInfixToPostfix8() throws BadNextValueException,
DAIllegalArgumentException, DAIndexOutOfBoundsException,
ShouldNotBeHereException, UnmatchingParenthesisException {
try {
infix.addLast("5");
QueueInterface<String> postFix = calc.infixToPostfix(... | 5 |
public void buildEventTree() {
eventRootNode.removeAllChildren();
List<ImgEvent> events = imageBrowser.getEvents();
if (events == null) {
return;
}
for (ImgEvent e : events) {
Calendar c = new GregorianCalendar();
c.setTimeInMillis(e.eventstart);
int year = c.get(Calendar.YEAR);
DefaultMuta... | 6 |
private static Key toKey(String password) throws Exception {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
SecretKey secretKey = keyFactory.generateSecret(keySpec);
return secretKey;
} | 0 |
public <T extends NMEAEvent<? extends NMEASentence>>void bindEvent( Class<? extends NMEASentence> c, T event )
{
events.put( c, event );
} | 2 |
public void applyPrefixes(LinkedList<Prefix> pre){
//Scan subject, predicate and object (data indices 0 to 2)
for (int i=0; i<3; i++){
String value=getByIndex(i);
//Starts with '<'? (IRI)
if (value.startsWith("<")){
//'a' predicate
if (i==1 && value.equals("<http://www.w3.org/1999/02/22-rdf-syntax-... | 6 |
private int aslB(int dest, int n) {
clearFlags(SR_N, SR_Z, SR_V, SR_C);
boolean hibitSet = msbSetB(dest);
boolean hasOverflow = false;
int result = dest;
boolean msbSet;
for (int i = 0; i < n; i++) {
msbSet = msbSetB(result);
if (msbSet) setFlags(SR_X, SR_C);
else clearFlags(SR... | 9 |
public static <E> Node<E> bookIterative(Node<E> head, int k) {
if (head == null) {
return null;
}
Node<E> p1 = head;
Node<E> p2 = head;
int i = 0;
for (; i < k && p1 != null; i++) {
p1 = p1.next;
}
// This condition to check if k i... | 6 |
public void paint(Graphics g) {
// This method is called by the swing thread, so may be called
// at any time during execution...
// First draw the background elements
/*
for (Element<Light> e : _lightElements) {
if (e.x.getState() == LightState.GreenNS_RedEW) {
g.setCol... | 7 |
private boolean fireReceiveExceptionEvent(ExceptionEvent evt) {
if (evt.getException() != null) {
logger.debug(getName() + " receive exception : " + evt.getException().getMessage());
}
return true;
} | 1 |
public static Professor addProfessors(Professor prof) {
boolean exist = false;
int pos = 0;
if (prof == null)
return null;
for (int i = 0; i < FileReadService.profList.size(); i++) {
if (FileReadService.profList.get(i).equals(prof)) {
exist = true;
pos = i;
}
}
if (!exist) {
FileReadServ... | 4 |
public void onKeyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case VK_UP:
case VK_W:
directions.remove(Direction.UP);
break;
case VK_DOWN:
case VK_S:
directions.remove(Direction.DOWN);
break;
case VK_RIGHT:
case VK_D:
directions.remove(Direction.RIGHT);
break;
case VK_LEFT:
ca... | 8 |
public void printCars(ArrayList<Car> carList) {
for (int i = 0; i < carList.size(); i++)
System.out.println(carList.get(i).toString());
} | 1 |
public static int getDatabaseMatchesInfo(int mode, int match, int teamID) {
mode++;
if (mode == 1) {
return getMatchAutoPoints(match, teamID);
} else if (mode == 2) {
return getMatchTelePoints(match, teamID);
} else if (mode == 3) {
return getMatchFris... | 9 |
synchronized public
void addElementWithReplacement (Element e) {
Element root = doc.getRootElement();
Collection<Element> oldCachedElements = queryXPathList(
String.format(ELEMENT_BY_URL_XPATH,e.getAttributeValue("url")));
for (Element current: oldCachedElements)
current.detach();
root.addContent((... | 1 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.