text stringlengths 14 410k | label int32 0 9 |
|---|---|
private ArrayList<ToDoItem> getItems(String cat) {
List list = data.getChildren();
ArrayList<ToDoItem> listOfItems = new ArrayList<>();
Iterator iter = list.iterator();
while (iter.hasNext()) {
Element e = (Element) iter.next();
if (cat.equals("") || cat.equals(e.... | 7 |
public double cos(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return cos[a];
}else if(a <= 180){
return -cos[180 - a];
}else if(a <= 270){
return -cos[a - 180];
}else{
return cos[360 - a];
}
} | 5 |
private static List<String> parseSqls(List<Sql> sqls, boolean undo) {
List<String> result = new ArrayList<String>();
for (Sql sql : sqls) {
result.add(undo? sql.getUndoSql():sql.getDoSql());
}
if (undo) {
Collections.reverse(result);
}
return result;
} | 3 |
public NumberMessageShower(String message, IOnStringInput onStringInput) {
super(message,SYMBOL, onStringInput);
} | 0 |
public static String getWindowImg(String wnd, int pos) {
if (pos < 1)
pos = 1;
int imgPos = 0;
Widget root = UI.instance.root;
for (Widget wdg = root.child; wdg != null; wdg = wdg.next) {
if (wdg instanceof Window)
if (((Window) wdg).cap.text.equal... | 9 |
private void consoleInput(){
if(KeyHandler.isPressed(KeyHandler.ESCAPE))
isConsoleDisplayed = false;
else
consolePrint = KeyHandler.keyPressed(KeyHandler.ANYKEY, consolePrint);
if(KeyHandler.isPressed(KeyHandler.ENTER))
consoleCommands(consolePrint);
} | 2 |
@Override
public void copySources( HashMap<String, Source> srcMap )
{
if( srcMap == null )
return;
Set<String> keys = srcMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source source;
// Make sure the buffer m... | 9 |
public static void updateUtilisateur(Utilisateur utilisateur) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from utilisateur where id_utilisateur=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, util... | 4 |
@SuppressWarnings("unchecked")
public void saveMessage(HttpServletRequest request, String msg) {
List messages = (List) request.getSession().getAttribute(MESSAGES_KEY);
if (messages == null) {
messages = new ArrayList();
}
messages.add(msg);
request.getSession()... | 1 |
public void setHasNegativeWeights(boolean hasNegativeWeights) {
this.hasNegativeWeights = hasNegativeWeights;
} | 0 |
private void calcRowSizes(int[] rows, int size, int iterations, int mod)
{
zeroArray(rows, size);
for(int index = 0; index < size; index++)
{
if(index == 0 || index == size -1)
{
rows[index] = iterations;
}
else
{
... | 8 |
public static void setLogLevel(Level newLevel) {
PropertyTree.logger.setLevel(newLevel);
PropertyTree.consoleHandler.setLevel(newLevel);
} | 0 |
public PersonBean getPerson() {
return person;
} | 0 |
public static IProtocalInfo getProtocalInfoType(String name) {
if (name.equalsIgnoreCase(ProtocolType.EJB.name())) {
return new EJBProtocalInfo();
} else if (name.equalsIgnoreCase(ProtocolType.WEBSERVICE.name())) {
return new WebServiceProtocalInfo();
} else if (name.equa... | 9 |
public String getPopulationDetails(Field field)
{
StringBuffer buffer = new StringBuffer();
if(!countsValid) {
generateCounts(field);
}
for(Class key : counters.keySet()) {
Counter info = counters.get(key);
int stringLength = info.getName().length(... | 2 |
public boolean equals(Object configuration) {
if (configuration == this)
return true;
try {
return super.equals(configuration)
&& myUnprocessedInput
.equals(((FSAConfiguration) configuration).myUnprocessedInput);
} catch (ClassCastException e) {
return false;
}
} | 3 |
public void setDesignacao(String designacao) {
this.designacao = designacao.isEmpty() ? "sem designação" : designacao;
} | 1 |
public void zoomIn(double mouseXCoord, double mouseYCoord)
{
zoomInConstant = 0.98;
if (visibleArea.getyLength() <= (quadTreeToDraw.getQuadTreeLength() / 5000))
{
return;
}
final double mouseMapXCoord = convertMouseXToMap(mouseXCoord);
final double mouseMapYCoord = convertMouseYToMap(mouseYCoord);
fin... | 1 |
public void host(int port) {
player1.setPos(4, HEIGHT / 2);
player2.setPos(WIDTH - 12, HEIGHT / 2);
hosting = true;
try {
serverSocket = new ServerSocket(port);
serverSocket.setSoTimeout(1000);
serverThread = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted... | 6 |
public UrinalStatus occupyUrinalVO( final int urinalPositionToOccupy ) {
UrinalStatus status = urinalVOs.get( urinalPositionToOccupy ).getStatus();
if( status == UrinalStatus.OCCUPIED )
return UrinalStatus.OCCUPIED;
else if( status == UrinalStatus.TRAPPED )
return UrinalStatus.TRAPPED;
else {
urinalVOs... | 7 |
public static void copyTo(InputStream in, OutputStream out) throws IOException {
int c;
while ((c = in.read()) != -1)
out.write(c);
out.flush();
} | 1 |
public ArrayList<ArrayList<Card>> holeCardsCombinations() {
ArrayList<ArrayList<Card>> combinations = new ArrayList<ArrayList<Card>>();
for (int i = 0; i < cards.size(); i++) {
for (int j = i + 1; j < cards.size(); j++) {
ArrayList<Card> combination = new ArrayList<Card>();
combination.add(cards.get(i))... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof User)) return false;
User user = (User) o;
if (id != user.id) return false;
if (!email.equals(user.email)) return false;
if (!name.equals(user.name)) return false;
if (!password.equals(user.password)) return fals... | 7 |
public static Connection getConnection() {
try {
driver = PropertiesReader.getValue("driver");
url = PropertiesReader.getValue("url");
user = PropertiesReader.getValue("user");
pwd = PropertiesReader.getValue("pwd");
} catch (Exception e) {
// TODO: handle exception
}
try {
// load driver
... | 3 |
public void handleAndSendReply(final BufferedInputStream in)
throws IOException {
// Peek at the reply id and tag.
in.mark(200);
final XMLInputFactory xif = XMLInputFactory.newInstance();
final String networkReplyId;
final boolean question;
try {
fi... | 6 |
public static void main(String[] args) {
System.err.println("INDI for Java Basic Server initializing...");
int port = 7624;
for (int i = 0 ; i < args.length ; i++) {
String[] s = splitArgument(args[i]);
if (s[0].equals("-p")) {
try {
port = Integer.parseInt(s[1]);
} ... | 8 |
@Override
public void run()
{
try
{
this.init();
this.isRunning = true;
while(this.isRunning)
{
this.currentTime = System.currentTimeMillis();
if(this.currentTime-this.lastClockTime >= 1000L)
{
this.applet.showStatus("UPS: "+this.cups+" RPS: "+this.crps);
this.ups = this.cup... | 5 |
public void update() {
KeyboardAdapter kba = KeyboardAdapter.getInstance();
int dx = 0;
int dy = 0;
if (kba.isPressed(KeyboardAdapter.KEY_NAME.UP)) {
dy -= speed;
}
if (kba.isPressed(KeyboardAdapter.KEY_NAME.DOWN)) {
dy += speed;
}
if (kba.isPressed(KeyboardAdapter.KEY_NAME.LEFT)) {
dx -= speed... | 9 |
public static File renameFile(String srcFile, String destFile)
{
if (StringUtils.isBlank(srcFile) || StringUtils.isBlank(destFile))
{
return null;
}
File oldfile = new File(srcFile);
File newfile = new File(destFile);
if (oldfile.renameTo(newfile))
... | 3 |
private ArrayList<Models.DatabaseModel.Bill> findUserBill(int patientId, boolean outStanding) {
String query = "SELECT `bill`.`billId`, "
+ " `bill`.`patientId`, "
+ " `bill`.`dateCreated`, "
+ " `bill`.`datePaid`, "
+ " `bill`.`con... | 4 |
* @param client
*/
private void cmd_set(final String arg, final Client client) {
final Player player = getPlayer(client);
final Room room = getRoom(player.getLocation());
MUDObject mobj;
// ex. @set here=header:======================
debug("SET: " + arg);
String[] args = arg.split("=", 2);
/... | 9 |
public void stacksum(String[] split)// prints the total from each person of
// a person's stack
{
if (split.length != 2)
{
PrintMessage("Syntax:!score [player]");
return;
}
Player p = (Player) getPlayer(split[1]);
if (p == null)
{
PrintMessage(split[1] + " does not exist");
return;
}
for (... | 6 |
public void pop() throws NotExistException {
if (amount != 0) {
head = head.next;
} else {
throw new NotExistException("Stack is empty!");
}
} | 1 |
public static String countAndSay(int n) {
if (0 >= n) return "";
if (1 == n) return "1";
String str = "1";
for (int i = 0; i < n - 1; i++) {
int num = 1;
StringBuffer temp = new StringBuffer();
for (int j = 0; j < str.length(); j++) {
if (0 == j) {
if (s... | 8 |
private void saveSettings() {
String[] resolution = ((String) view.getCmbResolution().getSelectedItem()).split("x");
if (resolution.length == 2) {
settings.setWidth(Integer.parseInt(resolution[0]));
settings.setHeight(Integer.parseInt(resolution[1]));
} else {
log.fine("Bad resolution form... | 9 |
public int writeVarLong (long value, boolean optimizePositive) throws KryoException {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
int varInt = 0;
varInt = (int)(value & 0x7F);
value >>>= 7;
if (value == 0) {
writeByte(varInt);
return 1;
}
varInt |= 0x80;
varInt |= ((value & 0x... | 9 |
public static <T extends DC> Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> despatch(Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>> pair,
Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> sets)
{ if(pair==null)
... | 3 |
@Override
public void setCivilState(String civilState) {
super.setCivilState(civilState);
}; | 0 |
private void drawCollection(Graphics2D g, Object collection, Class cls) {
ModelEntityAdapter adapter = modelAdapters.get(cls);
if (adapter == null) return;
if (collection instanceof Map) {
Map map = (Map)collection;
for (Object key: map.keySet()) {
Object obj = map.get(key);
ModelEntity en = (Model... | 9 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Uitlening)) {
return false;
}
Uitlening other = (Uitlening) object;
if ((this.id == null && other.id != null) |... | 5 |
public String toString() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: toString() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: toString() END");
}
return "Coordinate(" + m_X + ", " + m_Y + ", " + m_Value + ")";
} | 4 |
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._var_ == oldChild)
{
setVar((PVar) newChild);
return;
}
if(this._aDe_ == oldChild)
{
s... | 6 |
public String compareFiles(String filenameOK, String filenameOUT) throws FileNotFoundException {
Scanner sOK = new Scanner(new File(filenameOK));
Scanner sOUT = new Scanner(new File(filenameOUT));
while (sOUT.hasNext()) {
String s1 = sOK.nextLine();
String s2 = sOUT.next... | 2 |
private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} | 7 |
public boolean existeStation(Station s){
if(s == null) return false;
for(Station st : stations){
if(st != null) {
if(st.getNom().equals(s.getNom())){
return true;
}
}
}
return false;
} | 4 |
public String getTypeName() {
return this.typeName;
} | 0 |
public boolean validationCategory (String chargeCategory) {
Statement statement = null;
try {
statement = connection.createStatement();
statement.execute("select category from categories");
ResultSet set = statement.getResultSet();
while(set.next()){
... | 5 |
void setExampleWidgetBackgroundImage () {
if (backgroundImageButton != null && backgroundImageButton.isDisposed()) return;
Control [] controls = getExampleControls ();
for (int i=0; i<controls.length; i++) {
controls [i].setBackgroundImage (backgroundImageButton.getSelection () ? instance.images[ControlExample... | 4 |
@After
public void tearDown() {
} | 0 |
public void generate(Shell parentShell, IType objectClass) {
IMethod existingEquals = objectClass.getMethod("equals",
new String[] { "QObject;" });
IMethod existingHashCode = objectClass.getMethod("hashCode",
new String[0]);
Set excludedMethods = new HashSet();
... | 9 |
public static String reverseWords(String s) {
List<String> words = new ArrayList<String>();
int len = s.length();
StringBuffer res = new StringBuffer();
String word = null;
int begin = 0, end = 0;
for (int i = 0; i < len; i++) {
if (' ' == s.charAt(i)) {
if (end != begin) {
word = s.substring(be... | 6 |
public static Set smallerSymbols(Grammar grammar) {
Set smaller = new HashSet();
Production[] prods = grammar.getProductions();
boolean added;
do {
added = false;
for (int i = 0; i < prods.length; i++) {
String left = prods[i].getLHS();
String right = prods[i].getRHS();
int rightLength = minim... | 6 |
public BuscarItem() {
setLayout(new GridLayout(2,2));
aceptarBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Inventario.setStatusBarText("Se dispone a buscar una cadena!!!");
IServidorInventario servidor = ConexionServidor.getServidor();
String buscar = bu... | 8 |
public int minCut(String s) {
int n = s.length();
int[] part = new int[n];
boolean[][] isPalindrome = new boolean[n][n];
//j as start index, i + 1 as length
for(int i = 0; i < n; i++) {
for(int j = 0; j < n - i; j++) {
if(i < 1)
isPalindrome... | 9 |
private static void game() {
while (continueGame) {
listElements(); //Prints out the elements you have
String element1 = GuiMaster.getEnteredText();//inputs first element
if(elementValidize(element1)){ //checks first and second
String element2 = GuiMaster.getEnteredText();; //inputs second element
... | 5 |
public void upgradePawn(Point location, Piece newPiece)
{
if(!this.isOnBoard(location))
{
throw new AssertionError("This location: "+location+"isn't on the board");
}
if(!(newPiece instanceof Queen ||newPiece instanceof Rook ||newPiece instanceof Bishop||newPiece instanceof Knight))//if it isn't a queen,... | 6 |
public boolean isOccupied(int x, int y){
for (int i = 0; i < mobs.size(); i++){
int occupiedX = mobs.get(i).getX();
int occupiedY = mobs.get(i).getY();
if (x == occupiedX && y == occupiedY){
return true;
}
}
return false;
} | 3 |
@EventHandler
public void registerEconomyPlayer(PlayerJoinEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user == null)
return;
try {
if (economy.existsEconomyPlayer(player.getName()))
return;
economy.registerEcono... | 3 |
private boolean isNumberStart() {
if (isEof()) {
return false;
}
int[] c = peek3();
if (isDigit(c[0]) || (c[0] == '.' && isDigit(c[1]))) {
return true;
}
if (c[0] == '+' || c[0] == '-') {
if (isDigit(c[1])) {
return tr... | 9 |
public static double incrementPrice(double price) {
double newPrice;
if (price >= 100.0) {
newPrice = price + 10.0;
} else if (price >= 50.0) {
newPrice = price + 5.0;
} else if (price >= 30.0) {
newPrice = price + 2.0;
} else if (price >= 20.0... | 9 |
public static void main(String[] args) {
String input;
System.out.println("Enter the string ");
Scanner scan = new Scanner(System.in);
input = scan.nextLine();
System.out.println("Reversed word : " + reverseWord(input));
} | 0 |
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... | 9 |
private void detectEnd(){
if(LogController.getConsumedLogs() >= endNum){
threadFlag = false;
}
} | 1 |
public Double convert(Object object,Double defultValue,Object... args) throws HeraException{
if(object instanceof Integer){
return new IntegerDoubleConverter().convert((Integer)object, defultValue, args);
} else if(object instanceof Long){
return new LongDoubleConverter().convert((Long)object, defultValue, ... | 4 |
protected void printParameter(String parentParameterFile,
String childParameterFile, ArrayList<_Doc> docList) {
System.out.println("printing parameter");
try {
System.out.println(parentParameterFile);
System.out.println(childParameterFile);
PrintWriter parentParaOut = new PrintWriter(new File(
pa... | 6 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value instanceof javax.swing.Icon) value = new JLabel((Icon) value);
if (value instanceof ZoomButtons) value=new DropButton((ZoomButtons)value);
((JComponent)value).... | 5 |
public static Proposition buildTopLevelProposition(Stella_Object tree, boolean trueassertionP) {
if (Stella_Object.isaP(tree, Logic.SGT_STELLA_STRING_WRAPPER)) {
return (Logic.buildTopLevelProposition(Stella.readSExpressionFromString(((StringWrapper)(tree)).wrapperValue), trueassertionP));
}
{ Proposi... | 8 |
public static <V> List<V> topologicalSort(final DirectedGraph<V> g) {
List<V> ts = new LinkedList<>();
int inDegree[] = new int[g.getNumberOfVertexes()];
Queue<V> q = new LinkedList<>();
int i = 0;
// for every vertex...
for (V vertex : g.getVertexList()) {
i... | 8 |
@Override
public void update(final Observable o, final Object arg) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
update(o, arg);
}
});
... | 2 |
public void loadFromFiles() {
List<String> categories = Arrays.asList("pets", "futurama", "perl",
"smac", "starwars", "familyguy", "humorists", "computers", "linux", "goedel",
"art", "ascii-art", "cookie", "debian", "definitions", "drugs", "education",
"ethnic", "firefly", "food", "fortunes", "kids", "kn... | 8 |
private static String convertToHex(byte[] data) {
StringBuilder buf = new StringBuilder(50);
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
... | 4 |
static void LWS()
{
Scanner in = new Scanner(System.in);
final Board b = Board.readBoard(in);
ArrayList<Integer> nextPiece = new ArrayList<Integer>();
while(in.hasNextInt())
nextPiece.add(in.nextInt());
Heuristic hAll [] =
{
new LinearWeightedSum(new double[] {0.3,0.1,0.6,0.0,}),
new Line... | 3 |
@Override
public void encodeTerm(long[] longs, DataOutput out, FieldInfo fieldInfo, BlockTermState _state, boolean absolute) throws IOException {
IntBlockTermState state = (IntBlockTermState)_state;
if (absolute) {
lastState = emptyState;
}
longs[0] = state.docStartFP - lastState.docStartFP;
... | 8 |
private static Thread createCommandManagerThread(PrintStream commandSender) {
CommandManager commandManager = new CommandManager(commandSender, verbose);
log.info("Create commandManager");
Thread commandManagerThread = new Thread(commandManager);
log.info("Create commandManagerThread");
return commandManagerT... | 0 |
private void computePositions() {
// Determine time for rendering
if (fConf.getInt("fixedTime") == 0) {
// No fixed time.
// final long lTimePassed = System.currentTimeMillis() - fsStartTime;
// fCurrentTime = fsStartTime + (long) (fConf.getDouble("timeWarpFactor") * lTimePassed);
fCurrentTime = System.... | 8 |
public static Filter createFilter(String command) {
// NYI: A filter with arguments.
command = command.trim();
int argIndex = command.indexOf(" ");
String name = null;
if (argIndex > 1) {
name = "filters." + command.substring(0, argIndex);
} else {
... | 7 |
@Override
public String getPayRecord(String mid) {
// TODO Auto-generated method stub
String payRecordInfo = "";
ArrayList<PayRecord> payRecords = new ArrayList<>();
String sql = "select * from payrecord where mid = \'" + mid + "\'";
try {
resultSet = statement.executeQuery(sql);
while (resultSet.nex... | 4 |
private boolean setColumnDividerHighlight(int x) {
int oldDividerIndex = mMouseOverColumnDivider;
int dividerIndex = mAllowColumnResize ? overColumnDivider(x) : -1;
setCursor(dividerIndex == -1 ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
mMouseOverColumnDivider = dividerIn... | 3 |
private void addMainFunction(StringBuilder code){
// variables names:
final String luminance = "luminance";
final String feature = "feature";
final String heightColor = "h";
// function code:
String func = "void main(void){\n";
... | 6 |
public void loadAllStaff(){//COMPLETE
try {
ResultSet dbAllStaff = null;
Statement statement;
statement = connection.createStatement();
dbAllStaff = statement.executeQuery( "SELECT Staff.staffID, Staff.role FROM Staff;");
wh... | 4 |
@Override
public int compare(Quiz quiz1, Quiz quiz2) {
if (quiz1.raterNumber == 0)
return 1;
if (quiz2.raterNumber == 0)
return -1;
if (quiz1.totalRating / quiz1.raterNumber > quiz2.totalRating / quiz2.raterNumber)
return -1;
else
return 1;
} | 3 |
public boolean Salvar(Email obj, int idPessoa) {
try{
if(obj.getId() == 0){
PreparedStatement comando = banco.getConexao()
.prepareStatement("INSERT INTO emails (endereco,"
+ "id_pessoa,ativo) VALUES (?,?,?)");
... | 2 |
public int[] getHitBox() {
if (isWalking) {
switch (getFacing()) {
case North:
return new int[] {trueX(), trueY(), trueX(), trueY() - 1};
case South:
return new int[] {trueX(), trueY(), trueX(), trueY() + 1};
case East:
return new int[] {trueX(), trueY(), trueX() + 1, trueY()};
case West:
... | 5 |
public EncryptedCommunityCards listenForCommunityCards()
throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException, NoSuchAlgorithmException,
InvalidSubscriptionException, IOException, InterruptedException {
final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '"
+ COMMUNITY_CARD... | 2 |
void assignToRow( Atom a ) throws Exception
{
if ( !addToExisting(a) )
{
Row r = new Row( sigla, groups, base );
// this will always be a nested row
r.setNested( this.nested() );
FragList fl = new FragList();
fl.setBase( a.versions.nextSetB... | 3 |
public ArrayList<Point> getAllFreeSpots(){
ArrayList<Point> result = new ArrayList<Point>();
for(int x=0; x<level.length; x++){
for(int y=0; y<level[0].length; y++){
if(level[x][y] == null){
result.add(new Point(x, y));
}
}
}
return result;
} | 3 |
private boolean advanceRpts(PhrasePositions pp) throws IOException {
if (pp.rptGroup < 0) {
return true; // not a repeater
}
PhrasePositions[] rg = rptGroups[pp.rptGroup];
FixedBitSet bits = new FixedBitSet(rg.length); // for re-queuing after collisions are resolved
int k0 = pp.rptInd;
int... | 9 |
public <T> T getProperty( String key, Class<T> type ) {
Object value = parsed.get( key );
if ( value != null ) {
try {
return type.cast( value );
} catch ( ClassCastException cce ) {
// fall through to ParseException below
}
} else {
try {
Method method = this.getClass().getMethod( "get" +... | 7 |
@Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
states[0] = monkeyDay(new GameState(state), card, false);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
... | 3 |
public static String get(String ip, String comunidade, String objeto) throws Exception {
System.out.println("\nSNMP Get");
System.out.println("Objeto: " + objeto);
System.out.println("Comunidade: " + comunidade);
// Inicia sessaso SNMP
TransportMapping transport = new DefaultUdp... | 8 |
@org.junit.Test
public void testLevels_Grey2JUL()
{
LEVEL[] levels = LEVEL.values();
for (int idx = 0; idx != levels.length; idx++)
{
LEVEL lvl = levels[idx];
java.util.logging.Level jul_lvl;
switch (lvl)
{
case OFF: jul_lvl = java.util.logging.Level.OFF; break;
case ALL: jul_lvl = java.util... | 9 |
public cell getCell(int x, int y){
cell hyperion = new conveyorCell();
switch(aamode){
case 1: hyperion = pete.culture[x][y];
case 2: for(int b = 0; b < gridy; b++){
for(int a = 0; a < gridx; a++){
if(x >= grid[a][b].xmin && y >= grid[a][b].ymin){
if(x <= grid[a][b].xm... | 8 |
private String mygettoken() {
while (this.index < this.length){
char c = this.line.charAt(this.index);
if (this.flag) {
if (this.resky.indexOf(c) != -1) {
if (this.count > 0) {
String t = this.line.substring(this.start,this.... | 9 |
@Test
public void testExecutionSuccess() throws ExecutionException {
IProcessComponent<Void> decoratedComponent = TestUtil.executionSuccessComponent(true);
IProcessComponent<Void> busyComponent = new BusyComponent(decoratedComponent);
AsyncComponent<Void> ac = new AsyncComponent<Void>(busyComponent);
Future<... | 5 |
public boolean checkThatDatesSelected() {
String checkFromDate = this.fromDate.getText();
String checkTillDate = this.tillDate.getText();
Date frDate = null;
Date tiDate = null;
try {
tiDate = currentFormat.parse(checkTillDate);
} catch (ParseException e) {
... | 9 |
public void run()
{
try
{
this.MPrioW.acquire();
if(this.counter == 0)
this.MReading.acquire();
this.counter++;
this.MPrioW.release();
this.MWriting.acquire();
System.out.println("Ecriture");
Thread.sleep(1000);
this.MWriting.release();
this.MPrioW.acquire();
this.co... | 3 |
private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... | 1 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
Outliner.documents.addDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
setEnabled(false);
} | 0 |
public void refreshGrid(Square[][] grid) {
if (grid != null) {
board = grid;
}
playerList.clear();
for (int j = 1; j < BOARD_SIZE - 1; j++) {
for (int k = 1; k < BOARD_SIZE - 1; k++) {
if (board[j][k].getPlayer() != null) {
if (!board[j][k].getPlayer().getName().contains("Enemy")) {
playerL... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 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.