text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void prepare(CharSequence exp)
throws ParseException {
algorithm.clear();
final int length = exp.length();
NodeDefinition current_def = null;
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < length; i++) {
char current_char = exp.charAt(i);
if (current_def == null) {
/*
... | 7 |
public void appendToTail(int x){
ListNode newNode = new ListNode(x);
ListNode node = this;
while(node.next!=null) {
node = node.next;
}
node.next = newNode;
} | 1 |
public void start(BundleContext context) throws Exception {
m_context = context;
// Create a service tracker to monitor dictionary services.
m_tracker = new ServiceTracker(m_context, m_context.createFilter("(&(objectClass=" + DictionaryService.class.getName() + ")" + "(Language=*))"), null);
m_tracker.open();
... | 5 |
public void testisEmptyLeaf(int count) throws Exception {
for (int i = 0; i < 100; i++) {
RBtree empt = empty();
if (!empt.isEmpty()) {
throw new Exception("FAILURE EMPTY IS NOT EMPTY");
}
else {
int len = (int)(Math.random() * (10 - 1) + 1);
RBtree tree = randomRB( len );
if (tree.... | 4 |
@Test
public void shouldThrowErrorWhenCharactersAreInvalid() throws IOException {
//given
File tmpFile = folder.newFile(FILENAME);
FileOutputStream fileOutputStream = new FileOutputStream(tmpFile, true);
CharsetEncoder charsetEncoder = Charset.forName(ENCODING).newEncoder();
... | 1 |
public void mouseClicked(MouseEvent me)
{
try
{
if (me.getSource() == jb_connexion)
{
login = jtf_login.getText();
password = String.valueOf(jpf_password.getPassword());
System.out.println("Email : "+login);
System.out.println("MotDePasse : "+password);
User u = null;
... | 6 |
private static JMenu getHelpMenu(EnvironmentFrame frame) {
Environment environment = frame.getEnvironment();
JMenu menu = new JMenu("Help");
Serializable object = environment.getObject();
//Currently commented out, but can be restored if the help menus are fixed.
//addItem(menu, new EnvironmentHelpAction(env... | 0 |
public void start() throws GameNotInitializedException {
if (!initialized) {
throw new GameNotInitializedException("Game not initialized");
}
while (!gameEnded) {
try {
// It's just a delay for display
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
playTu... | 3 |
public char getOrbitalLetter()
{
int oNum = getOrbitalNum();
if(oNum == 2)
return 's';
else if(oNum == 6)
return 'p';
else if(oNum == 10)
return 'd';
else if(oNum == 14)
return 'f';
System.err.println("getOrbitalLetter - Orbital number is out of bounds");
return '?';
} | 4 |
private String[] getVariablesNamesInScope(Scope scope) {
TreeSet<String> result = new TreeSet<String>();
/*
* TODO: Frank, what to do with object/classes? For example test.test?
*/
boolean doneFirst = false;
String suffix = "local";
do {
if (!doneFirst && scope instanceof AstRoot) {
suffix = "... | 7 |
@Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
sendEntityDialogue(SEND_1_TEXT_CHAT,
new String[] { player.getDisplayName(),
"Can you tell me about the battlefield?" },
IS_PLAYER, player.getIndex(), 9827);
stage = 1;
} else if (stage == 1) {
sendEntityDial... | 7 |
@Override
protected void done(){
if(exit==0){
//If is successful, tell the user, and record it in the log file
JOptionPane.showMessageDialog(Download.this,"Finsh");
}
//If it is failed, show user the message
else if (exit==1){
JOptionPane.showMessa... | 7 |
void createExampleWidgets () {
/*
* Create the page. This example does not use layouts.
*/
int style = getDefaultStyle();
sashComp = new Composite(sashGroup, SWT.BORDER | style);
/* Create the list and text widgets */
list1 = new List (sashComp, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
list1.setI... | 3 |
private String getXML() {
JFileChooser chooser = new JFileChooser();
if(ProjectMainView.actualFolder!=null)
chooser.setCurrentDirectory(ProjectMainView.actualFolder);
FileNameExtensionFilter filter = new FileNameExtensionFilter("*.zip", "zip");
chooser.setFileFilter(filter);
chooser.setDialogTitle("Choose ... | 2 |
static private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 39:
return jjStopAtPos(0, 9);
case 40:
return jjStopAtPos(0, 7);
case 41:
return jjStopAtPos(0, 8);
case 43:
return jjStopAtPos(0, 15);
case 45:
return jjStartNfaWithS... | 7 |
public static Venue findById(long id) throws SQLException {
return findOne("id", String.valueOf(id));
} | 0 |
@Override
public void run() {
log("Connection accepted");
InputStream in;
OutputStream out;
IObjectChannel channel;
try {
in = client.getInputStream();
out = client.getOutputStream();
channel = channelFactory.create(out, in);
channel.setLogAdapter(this);
} catch (IOException e1) {
throw new... | 8 |
@Override
public void render(Value value, Object target, Class clazz, CoderContext context) throws ConversionException {
if (target instanceof Map) {
if (Map.class.isAssignableFrom(clazz)) {
Map map = (Map) target;
for (;;) {
if (!value.hasMore... | 9 |
@SuppressWarnings("unchecked")
public E previous() {
checkForComodification();
int i = cursor - 1;
if (i < 0) {
throw new NoSuchElementException();
}
cursor = i;
return (E) get(lastRet = i);
} | 1 |
public static int findMinimumDistance(int []input, int x, int y){
int prev =-1; int i=0;
int privIndex = -1;
int minDistance = Integer.MAX_VALUE;
//find first item which matches either of x or y
for(;i<input.length; i++) {
if(input[i] == x || input[i] ==y) {
... | 8 |
public void checkScore() {
switch(getScore()) {
case PLAYER1:
break;
case PLAYER2:
break;
case NONE:
break;
}
} | 3 |
public static List<Laureate> filterByCountry(List<Laureate> inputList, List<String> ListOfTerms) {
List<Laureate> outputList = new ArrayList<Laureate>();
// parse input, keep what matchs the terms.
for (Laureate Awinner : inputList) {
if (ListOfTerms.contains(Awinner.getCountry())) ... | 2 |
public boolean checkForVerticalStrike(String input) {
for (int i = 0; i < boardSize; i++) {
int count=0;
for (int j = 0; j < boardSize; j++,count++) {
if (boardArray[j][i].equalsIgnoreCase(input)) {
continue;
}
break;
... | 4 |
public static boolean nativeSlotPropositionP(Proposition self) {
{ Vector arguments = self.arguments;
if (((arguments.length()) == 0)) {
return (false);
}
{ Stella_Object firstarg = (((arguments.theArray)[0] != null) ? Logic.valueOf((arguments.theArray)[0]) : ((Stella_Object)(null)));
... | 7 |
@Override
public boolean runTest(){
return ((frontBack("code").equals("eodc")) &&
(frontBack("a").equals("a")) &&
(frontBack("ab").equals("ba")) &&
(frontBack("abc").equals("cba")) &&
(frontBack("").equals("")) &&
(frontBack("Chocolate").equals("ehocolatC")) &&
(frontBack("aavJ").equals("Java... | 7 |
public String serializeToString(Element root) {
StringBuilder sb = new StringBuilder("<");
sb.append(root.getTag());
String val;
for (String attName : root.attributeNames()) {
val = root.getAttribute(attName);
sb.append(String.format(ATTRIBUTE_FMT, attName, val))... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
else if (!(obj instanceof ObjectVariable))
return false;
ObjectVariable ov = (ObjectVariable) obj;
return (inQuotes == ov.inQuotes) && varname.equals(ov.varname) && v... | 4 |
@Override
public void execute()
{
if (args.length == 0)
p.openInventory(cm.getMain().getLM().getInventory());
if (args.length == 1)
{
if (Permissions.isAdmin(p))
{
if (args[0].equalsIgnoreCase("edit"))
{
edit();
}
}
if (args[0].equalsIgnoreCase("claim"))
{
claim();
}
... | 5 |
public void jugar(JFrame frame, EstadoVictoria escucharVictoria){
Point limitePueblo;
//cambio dificultad
System.out.println("dif min is " + this.defenseDiffMin + " and dif max is " + this.defenseDiffMax);
System.out.println("Gold min is " + this.goldMin + " and gold ma... | 2 |
public static Iterator fetchEdbQuery(Proposition proposition, LogicObject database, Stella_Object arguments) {
RDBMS.checkForExternalDbUpdates(proposition, database);
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOI... | 7 |
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
} | 1 |
public GrooveJaar() throws FileNotFoundException, IOException, InterruptedException, ExecutionException {
try {
//CountryUtil.initCountryCode();
//JGroovex.initiateQueue();
JGroove.getToken();
} catch (IOException e) {
showMessage("Fatal error.. Grooveshark.com seems to be down..");
e.printStackT... | 6 |
public boolean containsValue (Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = capacity + stashSize; i-- > 0;)
if (keyTable[i] != null && valueTable[i] == null) return true;
} else if (identity) {
for (int i = capacity... | 9 |
public String authenticateUser(String userName, String password, boolean isAdmin) throws SQLException {
String[] keys = {"userid", "username", "password"};
// qb = new QueryBuilder();
// Henter info om bruger fra database via querybuilder
resultSet = qb.selectFrom(keys, "users").where("username", "=", userN... | 6 |
public static String get_stack(final Throwable t) {
final PrintWriter pw = new PrintWriter(new StringWriter());
t.printStackTrace(pw);
return pw.toString();
} | 0 |
public void setSkill2(SkillsMain skill22) {
this.skill2 = skill22;
} | 0 |
public void run() {
setupRobot();
while (true) {
// Tell each component to act
wheel.act();
radar.act();
gun.act();
targetSelector.act();
execute();
}
} | 1 |
@Override
public byte[] save(JoeTree tree, DocumentInfo docInfo) {
StringBuffer buf = prepareFile(tree, docInfo);
try {
return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
r... | 1 |
public FileChooser(Forme forme) {
super("./Ressources/Images");
this.setDialogTitle("Choisir une image");
this.setMultiSelectionEnabled(false);
this.addChoosableFileFilter(filtre1);
this.addChoosableFileFilter(filtre2);
this.addChoosableFileFilter(filtre3);
this.addChoosableFileFilter(filtre4);
th... | 4 |
public int computeChineseFields() {
if (gregorianYear < 1901 || gregorianYear > 2100)
return 1;
int startYear = baseYear;
int startMonth = baseMonth;
int startDate = baseDate;
chineseYear = baseChineseYear;
chineseMonth = baseChineseMonth;
chineseDate = baseChineseDate;
// 第二个对应日,用以提高计算效率
// 公历2000... | 8 |
@Override
public String toString() {
if (minIteration != maxIteration) {
return String.format("%d - %d", minIteration + 1, maxIteration + 1);
} else {
return new Integer(minIteration + 1).toString();
}
} | 1 |
public static void main(String[] args) throws NumberFormatException, IOException{
int dividend = input("dividend");
int divisor = input("divisor");
output(division(dividend, divisor));
} | 0 |
@Override
public void sendUsageImpl(CommandSender sender) {
if (!(sender instanceof Player)) return;
sender.sendMessage(EdgeCore.usageColor + "/transfer <to> <amount> <description>");
User u = EdgeCoreAPI.userAPI().getUser(sender.getName());
if (u == null || !Level.canUse(u, Level.SUPPORTER)) return;
... | 5 |
public static ArrayList<Improvement> getValidImprovements(Civilization civ, BaseEntity en)
{
ArrayList<Improvement> temp = new ArrayList<Improvement>();
/*for (Entry<String, Improvement> entry: unitImprovementMap.entrySet())
{
String name = entry.getKey();
Improvement i = entry.getValue();
//Split into ... | 8 |
public <T> T httpRequest(HttpMethod method, Class<T> cls,
Map<String, Object> params, Object data, String... segments) {
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAccept(Collections
.singletonList(MediaType.APPLICATION_JSON));
if (accessToken !... | 8 |
private void drawGUI() {
setResizable(false);
setTitle("Email-Management");
setIconImage(Toolkit.getDefaultToolkit().getImage(iconPath));
addWindowListener(new WindowAdapter(this));
setBounds(100, 100, 331, 229);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnKontakt = new JMenu("Ko... | 0 |
@Override
public int compareTo(Bill o) {
if (this.date.before(o.getDate())) {
return -1;
} else if (this.date.after(o.getDate())) {
return 1;
} else
return 0;
} | 2 |
@Override
public void update() {
int speed = 6;
if (world.getCollidingEntities(this).size() == 0 && !inAnimation) {
move(0, speed);
}
if (world.getRacket().collidesWith(this)) {
inAnimation = true;
Game game = world.getGame();
game.g... | 9 |
public void loadStats() {
if(plugin.configData.trackStats) {
this.stats = new HashMap<String, Stat>();
this.globalSpins = 0;
this.globalWon = 0.0;
this.globalLost = 0.0;
Integer i = 0;
if(plugin.configData.stats.isConfigurationSection("types")) {
Set<String> types = plugin.configD... | 3 |
@Override
public void run(CommandArgs arg0) {
String[] args = arg0.getRawArgs().split(" ");
if (args.length > 1 && args[0].equals("site")) {
Integer id = Integer.parseInt(args[1]);
Site site = WebServer.getSiteByID(id);
if (site == null) {
Syst... | 4 |
private static <T extends Comparable<? super T>> T median3(
T[] a, int left, int right) {
int center = (left + right) / 2;
if (a[center].compareTo(a[left]) < 0)
swapReferences(a, left, center);
if (a[right].compareTo(a[left]) < 0)
swapReferences(a, left, right);
if (a[right].compareTo(a[center]) < 0)
... | 4 |
public static <T extends DC> Set<T> dom(Set<Pair<T,T>> phiMax)
{ if(phiMax!=null)
{ if(phiMax.getNext()!=null)
{ return new Set(phiMax.getFst().fst(),dom(phiMax.getNext()));
}
else
{ return new Set(phiMax.getFst().fst(),null);
}
}
else
{ return null;
}
} | 2 |
public void steal() {
synchronized (_cards) {
boolean[] found = new boolean[ins.length];
for (int i=0;i<ins.length;i++) found[i] = false;
ArrayList<Card> torm = new ArrayList<Card>();
for (Card c : _cards) {
for (int i=0;i<ins.length;i++) {
if (c.mytype == ins[i] &... | 8 |
void checkSignature(Class<?>... signatur) {
Class<?>[] parameters = method.getParameterTypes();
RuntimeException ex = new RuntimeException("Method " + method.getName() + " must have the following signature: " + Arrays.toString(signatur));
if(parameters.length != signatur.length)
throw ex;
for(int i... | 5 |
@Override
public void mouseReleased(MouseEvent e) {
Rectangle rect = new Rectangle(e.getX(), e.getY(), 1, 1);
Barrillo[] prebarrillo = barrillos.toArray(new Barrillo[0]);
Barrillo barrilloAExplotar = null;
for (Barrillo bar : prebarrillo) {
if (bar.devolverRectangle().int... | 2 |
@Override
public SXLValue castInto(String type) throws Exception {
switch( type ) {
case "string": return new SXLString( (value)? "true" : "false" );
case "boolean": return new SXLBoolean( value );
case "integer": return new SXLInteger( (value)? 1 : 0 );
case "real" : return new SXLReal( (value)? 1.0 : 0... | 9 |
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
if (context.containsBean("quarantinedDataSource")) {
LOG.info("Using quarantinedDataSource");
} else {
LOG.info("Using normal dataSource");
}
EventService service = context.getBean(E... | 3 |
public Population elitism(Population pop, int outSize){//cut percent (rather than number)
Individual [] subset = new Individual[outSize];
//sort by fitness
Comparator<Individual> indComp = new Comparator<Individual>() {
@Override
public int compare(Individual a, Individual b) {
double ... | 3 |
public JsonObjectBuilder rewriteJson(JsonObjectBuilder copyInto,JsonValue tree,String key){
/**
* Helper function used to parse json
*/
switch(tree.getValueType()){
case OBJECT:
JsonObject obj = (JsonObject) tree;
for(String name : obj.keySet()){
copyInto = rewriteJson(copyInto,obj.get(name),name)... | 3 |
private long highestPrimeFactor(long number){
if (isPrime(number)){
return number;
}
long factor = 2;
long highestPrimeFactor = 1;
while (factor <= number/factor){
if ((number%factor==0) && isPrime(factor)){
if (factor > highestPrimeFactor){
if (isPrime(number/factor)){
factor = ... | 6 |
@Override
public double observe() {
double observed = 0;
for (int i = 0; i < r; i++) {
observed += geom.observe();
}
return observed;
} | 1 |
public void pop() {
Menu menu = getCurrentMenu();
if (menu != null) {
menu.setMenuStack(null);
menuStack.pop();
}
} | 1 |
@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;
boolean success=proficienc... | 8 |
public String toString() {
String result = board.toString();
if (isGameOver())
result +="\n\n Game over";
return result;
} | 1 |
private PNGHelper() {
} | 0 |
@Override
public Position<T> left(Position<T> p) throws BoundaryViolationException,
InvalidPositionException {
BTPosition<T> rp = checkPosition(p);
Position<T> leftP = rp.getLeft();
if (leftP == null)
throw new BoundaryViolationException("No left child");
return leftP;
} | 1 |
private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
if(evt.getKeyCode() == evt.VK_F1){
btnovo();
}
if(evt.getKeyCode() == evt.VK_F2){
btAlterar();
}
if(evt.getKeyCode() == evt.VK_F3){... | 3 |
private void scan() {
if (updateList) {
for (int i = 0; i < numberOfAtoms - 1; i++) {
for (int j = i + 1; j < numberOfAtoms; j++) {
xij = atom[i].rx - atom[j].rx;
yij = atom[i].ry - atom[j].ry;
rij = xij * xij + yij * yij;
bondLength = getBondLength(atom[i], atom[j]);
if (rij <= bond... | 8 |
private String peekUrl(String filename){
String firstUrl = "";
try{
int i = 0;
BufferedReader in = new BufferedReader(new FileReader(filename));
String tmpFileName = filename + ".tmp";
BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFileName));
String line = "";
while((line = in.readLine(... | 3 |
final int memberValue(int pos) throws Exception {
int tag = info[pos] & 0xff;
if (tag == 'e') {
int typeNameIndex = ByteArray.readU16bit(info, pos + 1);
int constNameIndex = ByteArray.readU16bit(info, pos + 3);
enumMemberValue(typeNameIndex, constN... | 4 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(mob.getWorshipCharID().length()==0)
{
mob.tell(L("You must worship a god for this prayer to work."));... | 7 |
public OOXMLChart( Chart c, WorkBookHandle wbh )
{
// Walk up the superclass hierarchy
//System.out.println("BEFORE: chartArr: " + Arrays.toString(chartArr.toArray()));
for( Class obj = c.getClass(); !obj.equals( Object.class ); obj = obj.getSuperclass() )
{
java.lang.reflect.Field[] fields = obj.getDecla... | 5 |
public Set<Map.Entry<Integer,Float>> entrySet() {
return new AbstractSet<Map.Entry<Integer,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TIntFloatMapDecorator.this.isEmpty();
}
... | 8 |
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if (!plugin.hasPerm(sender, "weather", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
Player player = (Player) sender;
World world = player.get... | 4 |
public TrieNode getAdj(char ch){
return adj[getIndex(ch)];
} | 0 |
private Object handleFile(Object tos, String tagName) {
if (tos instanceof Header && ((Header)tos).getFile() == null) {
return new FieldRef(tos, "File");
}
else if (tos instanceof Media && ((Media)tos).getFile() == null) {
((Media)tos).setFileTag(tagName);
return new FieldRe... | 4 |
public void initGraph(String path){
BufferedReader file ;
String line;
String name, id;
int y = 0;
try
{
file = new BufferedReader(new FileReader(path)) ;
while ((line = file.readLine()) != null)
... | 8 |
public static void main(String[] args){
//check that the minimum number of command line arguments were entered
if(args.length<5){
System.out.println("attack, decay, sustain amp, sustain time, release");
System.out.println("Optional: Num_of_file, names of files");
System.exit(1);
}
... | 9 |
@Override
public Model getRotatedModel() {
Model model = spotAnimation.getModel();
if (model == null) {
return null;
}
int j = spotAnimation.sequence.frames[anInt1569];
Model model_1 = new Model(true, Animation.isNullFrame(j), false, model);
if (!aBoolean1567) {
model_1.skin();
model_1.transform(j... | 8 |
public static void main(String[] args) {
try {
Experiment exp = null;
// get options from XML?
String xmlOption = Utils.getOption("xml", args);
if (!xmlOption.equals(""))
args = new XMLOptions(xmlOption).toArray();
String expFile = Utils.getOption('l', args);
Str... | 9 |
public static FieldType convertToXMLFieldType(FieldState state) {
switch (state) {
case EMPTY:
return FieldType.EMPTY;
case WALL:
return FieldType.WALL;
case DIAMOND:
return FieldType.DIAMOND;
case PLAYER:
... | 7 |
public int getX(){
return x;
} | 0 |
private void runTest(File path) {
mOutput = 0;
System.out.println(path.toString());
try {
LarkScript script = new LarkScript(path.getPath());
mPassed = true;
// parse the script to get the expected behavior
... | 9 |
void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (singleButton.getSelection ()) style |= SWT.SINGLE;
if (multiButton.getSelection ()) style |= SWT.MULTI;
if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
if (verticalButton.getSelection ()) style |... | 5 |
public T arbitrary(Random random,long size)
{
if (random.nextDouble() < probability) {
return null;
}
else {
return generator.arbitrary(random, size);
}
} | 1 |
public String getProtocol() {
return this.protocol;
} | 0 |
public void mouseReleased(MouseEvent event) {
transitionInFlux = false;
if (event.isPopupTrigger())
showPopup(event);
State[] states = getView().getDrawer().getAutomaton().getStates();
int count = 0;
for(int k = 0; k < states.length; k++){
if(states[k].isSelected()){
count++;
}
... | 6 |
public void setFunConsumoUltimoMes(Integer funConsumoUltimoMes) {
this.funConsumoUltimoMes = funConsumoUltimoMes;
} | 0 |
public void insertDisc(int col, CellState player) {
if (!isFull(col)) {
// XXX getrowdepth in tmp_var speichern damit nicht 2x aufrufen?
model.setCell(col, getRowDepth(col), player);
this.isWinning(player, col, getRowDepth(col));
}
if (isFull()) {
EventSystem.getInstance().queueEvent(new GameStatusUp... | 2 |
public int hgetbits(int N)
{
totbit += N;
int val = 0;
int pos = buf_byte_idx;
if (pos+N < BUFSIZE)
{
while (N-- > 0)
{
val <<= 1;
val |= ((buf[pos++]!=0) ? 1 : 0);
}
}
else
{
while (N-- > 0)
{
val <<= 1;
val |= ((buf[pos]!=0) ? 1 : 0);
pos = (pos+1) & BU... | 5 |
public static void main(String[] args)
{
ArrayList<Product> products = new ArrayList<>();
try {
BufferedReader fileReader = new BufferedReader(new FileReader("D:\\Soft\\JAVA\\LoopsMethodsClasses\\src\\ListInput.txt"));;
File fileProducts = new File("D:\\Soft\\JAVA\\LoopsMethodsClasses\\src\\ListOutput.txt... | 4 |
public static void call(final String mapping, final String data) throws Exception {
// delimited by a comma
// text qualified by double quotes
// ignore first record
final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(mapping), new File(data), ',', '"',... | 5 |
public void saveToFile (String fileName) {
ZipOutputStream zipOut = null;
// create new ZIP file
try {
zipOut = new ZipOutputStream(new FileOutputStream(fileName));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return;
}
// enabl... | 5 |
public void visitSwitchStmt(final SwitchStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
stmt.visitChildren(this);
genPostponed(stmt);
final Label[] targets = new Label[stmt.targets().length];
for (int i = 0; i < targets.length; i++) {
targets[i] = stmt.targets()[i... | 2 |
public static String MD5(String plainText) {
StringBuffer buf = new StringBuffer("");
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
... | 4 |
public void verify() throws MVDException
{
SimpleQueue<Node> queue = new SimpleQueue<Node>();
HashSet<Node> printed = new HashSet<Node>();
start.verify();
queue.add( start );
while ( !queue.isEmpty() )
{
Node node = queue.poll();
node.verify();
ListIterator<Arc> iter = node.outgoingArcs(this);
... | 5 |
public void moveRight() {
if (ducked == false) {
speedX = MOVESPEED;
}
} | 1 |
OlogProperties(){
preferences = Preferences.userNodeForPackage(OlogClient.class);
try {
File userCFPropertiesFile = new File(System.getProperty(
"olog.properties", ""));
File userHomeCFPropertiesFile = new File(System
.getProperty("user.home")
+ "/olog.properties");
File systemCFProperti... | 7 |
@Override
protected void setAttrs(User model, PreparedStatement stmt) throws SQLException {
{
stmt.setString(1, model.getHandle());
}
if (model.getCreatedAtMillis() == null) {
stmt.setNull(2, java.sql.Types.INTEGER);
} else {
stmt.setLong(2, model.getCreatedAtMillis());
}
{
... | 8 |
public static String quote(String in) {
StringBuilder buf = new StringBuilder();
for(int i = 0; i < in.length(); i++) {
char c = in.charAt(i);
if((c == '$') || (c == '{') || (c == '}')) {
buf.append('$');
buf.append(c);
} else {
buf.append(c);
}
}
return(buf.toString());
} | 4 |
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.