text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static String definirDirectorio(JFrame frame) {
JFileChooser file = new JFileChooser();
file.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = file.showOpenDialog(frame);
switch (result) {
case JFileChooser.CANCEL_OPTION:
return ""... | 3 |
private boolean hasTag(String version) {
for (final String string : Updater.NO_UPDATE_TAG) {
if (version.contains(string)) {
return true;
}
}
return false;
} | 2 |
private void throwLoadError() {
String s = "ondemand";// was a constant parameter
System.out.println(s);
try {
getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
} catch (Exception exception) {
exception.printStackTrace();
... | 3 |
public void setKey(String key) {
byte[] keybyte = key.getBytes();
if (keybyte == null) {
throw new RuntimeException("No key");
} else if (keybyte.length < 16) {
throw new RuntimeException("Key too short");
// byte[] newkey = new byte[16];
// for (int i = 0; i < 16; i++) {
// newkey[i] = keybyte[i % k... | 3 |
public String buscarAgencia()
{
System.out.print("entre com a agencia: ");
return entrada.leiaString();
} | 0 |
@Override
public void keyPressed(KeyEvent event) {
if(this.inputBlocked) {
return;
}
switch(event.getKeyCode()) {
case KEY_LEFT:
case KEY_UP:
case KEY_DOWN:
case KEY_RIGHT:
JOptionPane.showMessageDialog(null, "MOVE");
clearMoveInput();
break;
default:
}
currentInput.put(event.get... | 5 |
public String authenticate(String username, String password, boolean isAdmin) {
try {
crs = qb.selectFrom("users").where("username", "=", username).executeQuery();
if (crs.next()){
if(crs.getBoolean("active")==true) {
if(crs.getString("password").equals(password)) {
if((crs.getBoolean("isAdmin")... | 9 |
private void displayDebuffEffects()
{
int var1 = this.guiLeft - 124;
int var2 = this.guiTop;
int var3 = this.mc.renderEngine.getTexture("/gui/inventory.png");
Collection var4 = this.mc.thePlayer.getActivePotionEffects();
if (!var4.isEmpty())
{
int var5 = ... | 7 |
public String Tclient(int num) throws SocketException, IOException, InterruptedException{
TelnetService TC;
if (num == 1){TC = TC1;TC1.mynum=1;}
else {TC = TC2;TC2.mynum=2;}
String rtn=TC.getTelnetSessionAsString(Integer.toString(num));
if (rtn.equals("reload")){return rtn;}
TC.readit(" ");
dw.append("Ser... | 4 |
public List<Statistik> getStatistikzuOrgaEinheitinKWundJahr(int idOrgaEinheit,
int kalenderWoche, int jahr) {
ResultSet resultSet;
List<Statistik> rueckgabe = new ArrayList<Statistik>();
try {
resultSet = db
.executeQueryStatement("SELECT * FROM Statistik WHERE idOrgaEinheit = '"
+ idOrgaEinheit... | 2 |
static final public void term() throws ParseException {
unary();
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MULTIPLY:
case DIVIDE:
;
break;
default:
jj_la1[3] = jj_gen;
break label_2;
}
switch ((jj_ntk==-1)?jj_ntk(... | 7 |
private boolean hasAmmo()
{
if(ammo == null)
return true; //no ammo defined, I can shoot.
//If I have ammo, I must have enough resource of ammo type to be able to shoot.
if(resources.containsKey(ammoId))
if(minAmmo > -1)
return resources.get(ammoId) >... | 3 |
private String serialContactSet(Set<Contact> contactSet) {
// Serialises contact sets to a string of their ids.
StringBuilder builder = new StringBuilder();
String seperator = "";
for(Contact each : contactSet) {
builder.append(seperator).append(each.getId());
sep... | 1 |
public static void removeMultipleCharacterLabelsFromAutomaton(Automaton automaton) {
Transition[] transitions = automaton.getTransitions();
for (int k = 0; k < transitions.length; k++) {
FSATransition transition = (FSATransition) transitions[k];
String label = transition.getLabel();
if (label.length() > 1)... | 2 |
public GOEPanel() {
m_Backup = copyObject(m_Object);
m_ClassNameLabel = new JLabel("None");
m_ClassNameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
m_ChildPropertySheet = new PropertySheetPanel();
m_ChildPropertySheet.addPropertyChangeListener
(new PropertyChang... | 9 |
@Override
public void run() {
setupSocket();
while(this.running) {
try {
Thread.sleep(1000);
this.connection = this.socket.accept();
InputStream inputStream = this.connection.getInputStream();
this.out = new ObjectOutputStream(this.connection.getOutputStream());
this.out.flush();
this.in... | 8 |
public static void readHash3(String type_map,
HashMap<String, Double> hashMap) {
ArrayList<String> types = new ArrayList<String>();
ArrayList<String> tokens = new ArrayList<String>();
if (type_map != null) {
FileUtil.readLines(type_map, types);
for (int i = 0; i < types.size(); i++) {
if (!types.ge... | 7 |
public void apply(Vector v) {
Index index = indexer.get();
Vector midpoint = new Vector((float) Math.floor(v.getX()),
(float) Math.floor(v.getY()))
.add(new Vector(0.5f,0.5f));
Boundary clear = new Boundary(0.25f, midp... | 7 |
private void run(Integer screenNum) {
initSubsystems();
registerListeners();
InetAddress address = client.discoverHost(54777, 5000);
if(address == null){
System.out.println("Error could not find Server on Lan!");
System.exit(0);
}
System.out.println("Connecting to " + address);
client.start... | 4 |
@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 Customer)) {
return false;
}
Customer other = (Customer) object;
if ((this.customerId == null && other.customer... | 5 |
private void jComboBoxModifieVilleListItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxModifieVilleListItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
Ville ville = ((Ville) this.jComboBoxModifieVilleList.getSelectedItem());
... | 1 |
private int locateMainToken( String token,
boolean caseSensitive ) {
for( int a = 0; a < this.params.size(); a++ ) {
List<List<String>> listB = this.params.get(a);
// First token equals the desired token?
if( listB.size() != 0
&& listB.get(0).size() != 0
&& ((caseSensitive && listB.get(0).ge... | 7 |
public void openDoor()
{
if(isOpening)
return;
OpenStartTime = (double)Time.getTime()/(double)Time.SECOND;
openTime = OpenStartTime + TIME_TO_OPEN;
closingStartTime = openTime + CLOSE_DELAY;
closeTime = closingStartTime + TIME_TO_OPEN;
isOpening = true;
... | 1 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 6 |
public DeltaSyncSession login(String username, String password)
throws AuthenticationException, DeltaSyncException, IOException {
if (username == null) {
throw new NullPointerException("username");
}
if (password == null) {
throw new NullPointerExcep... | 9 |
public void setNametextZoomedFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.nametextZoomedFontStyle = UIFontInits.NAMEZOOMED.getStyle();
} else {
this.nametextZoomedFontStyle = fontstyle;
}
somethingChanged();
} | 1 |
public static String getInput(String query) {
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
System.out.print(query);
try {
return console.readLine();
} catch (IOException ioe) {
ioe.printStackTrace();
return null;
}
} | 1 |
@Override
protected void processWindowEvent(WindowEvent e) {
if(e.getID() == WindowEvent.WINDOW_CLOSING){
if(JOptionPane.showConfirmDialog(this, "Are you sure you want to close? Unsaved data will be lost",
"WARNING", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE)
== JOptionPane.OK_OPTION){
... | 2 |
public int[] sortHeap(int[] tmpArray){
// build a heap
int[] sortHeap = new int[tmpArray.length];
sortHeap = this.buidHeap(tmpArray);
// get one and rebuild again, a easier build procedure completed by max-heap
// index of Array
for(int i = sortHeap.length-1; i > 0; i--){
// exchange A[i] with A[0], and ... | 3 |
public final JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
this.insertOrder.add(key);
put(key, value);
... | 3 |
public static void splitBinaryIndex(int x) {
FileInputStream fis;
BufferedInputStream bis;
DataInputStream dis;
try {
File fIndex = new File(index_dir + "index" + Common.extIDX);
fis = new FileInputStream(fIndex);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
String word1 =... | 8 |
private boolean isClassBox(String owner) {
if (!owner.startsWith("java/lang/")) {
return false;
}
String className = owner.substring("java/lang/".length());
return (className.equals("Integer") ||
className.equals("Double") ||
className.equal... | 7 |
public void run() {
packetProcessor.onSuccessfulStarted();
while ( true ) {
try {
DatagramPacket packet = new DatagramPacket( new byte[1024], 1024 );
socket.receive( packet );
InetAddress address = packet.getAddress();
int port = packet.getPort... | 3 |
private void createAndShowGUI() {
addButton = new IconButton(new AddItemPopupAction(),"./Resources/test.gif");
setLayout(new GridBagLayout());
GridBagConstraints btn = new GridBagConstraints();
btn.gridx = 1;
btn.gridy = 0;
btn.anchor = GridBagConstraints.EAST;
th... | 4 |
public void weibullTwoParProbabilityPlot(){
this.lastMethod = 12;
// Check for negative x values
if(this.sortedData[0]<0){
System.out.println("Method weibullTwoParProbabilityPlot: negative x value found - weibullThreeParProbabilityPlot called");
this... | 8 |
private boolean isIPBlacklisted(String address, File blacklistFile) {
try {
String line;
BufferedReader br = new BufferedReader(new FileReader(blacklistFile));
while ((line = br.readLine()) != null) {
if (line.equals(address)){
return true... | 3 |
private void skip(int num) throws IOException {
while (num > 0) {
long result;
if (in != null) {
result = in.skip(num);
} else {
result = din.skipBytes(num);
}
if (result > 0) {
num -= result;
... | 5 |
public void characters (char ch[], int start, int length) {
if (isTargetQuestion && !mutiAnswers){
ansNum = Integer.parseInt(new String(ch, start, length).trim());
isTargetQuestion = false;
}else if ((isTargetQuestion && mutiAnswers) && bAnswer){
ansNumList.add(new String(ch, s... | 5 |
public void getList(int rep,String searchText)
{
String tempQuery = "";
if(rep == 0) {
tempQuery = query;
}
else if(rep == 1) {
searchText = searchText.toUpperCase();
tempQuery = "select * from (Select suppid,suppname,contactno1,contactno2,emai... | 6 |
private void setLabels() throws IOException {
labels = parse.getLine();
if (labels == null) return;
labelMap = new HashMap<String,Integer>();
for (int i = 0; i < labels.length; i++){
labelMap.put(labels[i], new Integer(i));
}
} | 2 |
private void checkResponseType(String responseType, Properties propBP, Properties propP) throws Exception
{
if (responseType.equals("Discrete") || responseType.equals("Optimal") || responseType.equals("Normal"))
{
if (propBP.get("type") == null)
throw new Exception("ERROR: baseline pricing scheme undefi... | 7 |
public static void runTest(String fileInputName, String fileOutputName,
double minSupportLevel, double minConfidenceLevel) {
String errorFileOutputName = "ER_"+fileInputName;
String supMsg = checkLevels(minSupportLevel);
String confMsg = checkLevels(minConfidenceLevel);
ErrorLogs errorLogs = new ErrorLogs();... | 4 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TblSoIdPK other = (TblSoIdPK) obj;
if (!Objects.equals(this.InvoiceNumber, other.InvoiceNumber)) {
... | 4 |
public void act()
{
if (Greenfoot.mouseClicked(this))
{
switch(WORLD){
case 1:
Greenfoot.setWorld(new ShipCoordinator());
break;
case 2:
Greenfoot.setWorld(new CargoLifter());
... | 4 |
private Node insert(Node h, Key key, Value value, int ht) {
int j;
Entry t = new Entry(key, value, null);
// external node
if (ht == 0) {
for (j = 0; j < h.m; j++) {
if (less(key, h.children[j].key)) break;
}
}
// internal node
... | 9 |
public static void main(String[] args) {
String serviceName = null;
String serverIp = null;
int serverPort = 0;
if (args.length != 3) {
System.out.println("Usage: java test.test5Client <ServiceName> <ServerIp> <ServerPort>");
return;
} else {
serviceName = args[0];
serverIp = args[1];
serverPo... | 5 |
public synchronized void call(int from, int to) {
waitEntry[from]++;
liftView.drawLevel(from, waitEntry[from]);
notifyAll();
while (here != there || here != from || load >= 4) {
try { wait(); }
catch (InterruptedException e) { e.printStackTrace(); }
}
... | 8 |
public void checaColision() {
//Verifica que la barril no choque con el applet por la derecha
if (barril.getPosX() + barril.getAncho() > getWidth()) {
barril.setPosX(getWidth() - barril.getAncho());
}
//Verifica que barril no choque con el applet por la izquierda
... | 7 |
public String getRecommendListForTransitionModified(){
String recommend = "";
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/NETWORK_TEST?"
+ "user=root&password=root");
connect.setAutoCommit(false);
statement = connect.createStat... | 8 |
public void play(Agent other) {
int ownAction = getAction(other.getID());
int otherAction = other.getAction(id);
// Both agents cooperate.
if (ownAction == 1 && otherAction == 1) {
this.score += 3;
other.addScore(3);
}
// This agent cooperates, t... | 8 |
protected static byte nativeEncoding( Number num ) {
if( num instanceof Byte ) {
return NE_INT8;
} else if( num instanceof Short ) {
return NE_INT16;
} else if( num instanceof Integer ) {
return NE_INT32;
} else if( num instanceof Long ) {
return NE_INT64;
} else if( num instanceof Float ) ... | 5 |
@Override
public void keyTyped(KeyEvent e) {
// Restart when ESCAPE key is pressed twice in a row
if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
if (restartFlag) {
restartFlag = false;
restart();
}
else
... | 5 |
private static double[] getResistPoints(int curvePoints,int lineNumber, double[] highPrices) {
double[] rPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 0;
for(int j=-curvePoints;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && hig... | 5 |
private boolean comprobarOsi(String pLineaCodigo, int pPosicion, int pNumeroLinea) {
// Verifica que se hay ingresado si despues de la palabra si habia un espacio o '['
if (pLineaCodigo.charAt(pPosicion) == ' ' || pLineaCodigo.charAt(pPosicion) == '[' || pLineaCodigo.charAt(pPosicion) == '\t') {
... | 9 |
public static void CONVERTE_HEXA(String entrada){
String resultado = "";
int i = 0;
int cont = 1;
byte [] LFCR = {0x0D,0x0A};
String tipo = "(byte)0x";
int tam = entrada.length()/2;
for (i=0; i < entrada.length(); i+=2, cont++)
{ resultado = resultado + tipo + entrada.substring(i, i+2) ... | 2 |
@SuppressWarnings("deprecation")
private ItemStack getItem(String name, int stackSize) {
int id;
int dmg = 0;
String dataName = null;
if (name.contains(":")) {
String[] parts = name.split(":", 2);
dataName = parts[1];
name = parts[0];
}
try {
id = Integer.parseInt(name);
} catch (NumberForm... | 4 |
public boolean isNear(Point point, int fudge) {
if (needsRefresh)
refreshCurve();
try {
if (bounds.contains(affineToText.inverseTransform(point, null)))
return true;
} catch (java.awt.geom.NoninvertibleTransformException e) {
}
return false;
} | 3 |
public Set<ValueType> union(Set<ValueType> set1, Set<ValueType> set2) {
Set<ValueType> unionSet = new Set<>();
SetElement<ValueType> current = set1.head;
if (!set1.isEmpty()) {
while (current != set1.tail.getNext()) {
unionSet.addElement(current.getValue());
... | 5 |
public QuitConfirmDialog(final Skin skin, final boolean openNewSkin, final boolean openChooser) {
if (skin.isSkinChanged()) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
QuitConfirmDialog.this.setSize(new Dimension(475, 17... | 1 |
private void promoteInSets() {
for (Iterator i = predecessors.iterator(); i.hasNext();) {
FlowBlock pred = (FlowBlock) i.next();
SuccessorInfo succInfo = (SuccessorInfo) pred.successors.get(this);
/*
* First get the gen/kill sets of all jumps of predecessor to this
* block and calculate the intersec... | 3 |
public static long[] getKPrimesFromN(int n, int k, boolean print) {
long[] primes = new long[k+n];
primes[0] = 2;
int currPrimeCount = 1;
int fromNIndex = k;
int indexStartFrom = -1;
for(int i=3;fromNIndex>0;i+=2) { // even number cannot be prime
boolean isPrime = true;
long sqrt = (long) Math.sqrt(i)... | 8 |
public void setCreator(EditorPane pane) {
myCreator = pane;
} | 0 |
public void makeNonVoid() {
if (type != Type.tVoid)
throw new alterrs.jode.AssertError("already non void");
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
if (outer != null && outer.name == null) {
/* This is an anonymous class */
if (clazz.getInterfaces().length > 0... | 4 |
protected void flushImpl() {
if (source != null) {
source.drain();
}
} | 1 |
public double update_model_expectation() {
double logl = 0;
int ncorrect = 0;
_vme = newArrayList(_fb.Size(), 0.0);
for (Sample i : samples) {
double[] membp = new double[_num_classes];
int max_label = conditional_probability(i, membp);
logl += log(membp[i.label]);
// cout << ... | 9 |
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://down... | 6 |
public int getLength(String nickname) {
int a = nickname.length();
char n[] = new char[a];
int ans = 0;
int f = 0;
n = nickname.toCharArray();
for(int i = 0;i < a;i++){
if((n[i] == 'a')||(n[i] == 'i')||(n[i] == 'u')||(n[i] == 'e')||(n[i] == 'o')||(n[i] == 'y')){
if(f == 0){
ans++;
f = 1;... | 8 |
public void nextState() {
int[][] newState = new int[gridSize][gridSize];
for(int y = 0; y < gridSize; y++) {
for(int x = 0; x < gridSize; x++) {
int liveNeighbours = liveNeighbours(x,y);
if(liveNeighbours < 2 || liveNeighbours > 3)
newState[y][x] = 0;
else if(liveNeighbours == 3)
newState[... | 5 |
private void loadProvinces(Path baseDir) throws IOException {
Map<Integer, String> provinceNames = loadProvinceNames(baseDir);
Path provinceDefinitionsPath = getFilePath(MapFile.DEFINITIONS, baseDir);
try(BufferedReader reader = Files.newBufferedReader(provinceDefinitionsPath, MapUtilities.ISO... | 3 |
public void run()
{
try
{
while(Glory.getInstance().shouldThreadBeRunning())
;
}
catch(Exception e)
{
}
} | 2 |
public boolean play(int pos){
valid = true;
canResume = false;
try{
FIS = new FileInputStream(path);
total = FIS.available();
if(pos > -1) FIS.skip(pos);
BIS = new BufferedInputStream(FIS);
player = new Player(BIS);
new Thread(
new Runnable(){
public void ... | 3 |
final public CycObject sentenceDenotingRepresentedTerm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycObject val = null;
val = atomicSentenceDenotingRepresentedTerm(false);
eof(requireEOF);
{if (true) return val;}
throw new Error("Missing return sta... | 1 |
private static byte[][] ShiftRows(byte[][] state) {
byte[] t = new byte[4];
for (int r = 1; r < 4; r++) {
for (int c = 0; c < Nb; c++)
t[c] = state[r][(c + r) % Nb];
for (int c = 0; c < Nb; c++)
state[r][c] = t[c];
}
return state;
} | 3 |
@EventHandler
public void closeInventory(InventoryCloseEvent e) {
Player p = Player.class.cast(e.getPlayer());
if(PluginVars.editing.get(p) != null) {
PluginVars.editing.get(p).close();
}
if(PluginVars.commu_mode.get(p) != null) {
PluginVars.commu_mode.get(p).close(false);
}
if(PluginVars.spectating.... | 5 |
public BURodCutting(int n, int price[])
{
this.n = n;
p = price;
r = new int[price.length];
cuts = new String[price.length];
p[0] = 0;
r[0] = 0;
cuts[0] = "";
for (int i = 1; i < price.length; i++)
r[i] = Integer.MIN_VALUE;
cutRod(n);
} | 1 |
@Override
public void caseAConstructorHexp(AConstructorHexp node)
{
inAConstructorHexp(node);
if(node.getRPar() != null)
{
node.getRPar().apply(this);
}
if(node.getLPar() != null)
{
node.getLPar().apply(this);
}
if(node.getI... | 4 |
private VariableType factor() {
VariableType type;
Token t = popToken();
switch(t.getTokenType()) {
case SCONSTANT:
return VariableType.INTEGER;
case SSTRING:
if(t.getValue().length() == 3) {
return VariableType.STRING_LENGTH1;
} else {
return VariableType.CHAR_ARRAY;
}
case SFALSE:
ca... | 9 |
public void dowork(){
Thread t1 = new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
for (int i=0;i<100000;i++){
increment();
}
}
});
Thread t2 = new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated met... | 4 |
public String execute(DataSource source, String classTable,
List<String> trainningModelTables, Map<String, Object> params) {
StringBuilder sb = new StringBuilder();
// -- app runtime
sb.append(SqlGenerator.setSchema(schemaName));
if (params != null) {
sb.append(algorithm.updateParams(params));
}
s... | 9 |
private void setModifier(String mod) {
if (mod ==null) return;
if (!(mod.equals(BLOCK)||mod.equals(JUMP))) return;
this.modifier = mod;
} | 3 |
@Test
public void testMultipleMessagesMultipleSubscribers() {
int noOfSubscribers = 2;
int noOfMessages = 5;
final HashMap<String, AtomicInteger> messages = new HashMap<String, AtomicInteger>();
final AtomicInteger msgCount = new AtomicInteger(0);
try {
final String message = "TestMessage-testGetMessage_... | 5 |
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return da... | 1 |
@Override
public synchronized void start() throws Exception {
if (!isActive()) {
if (!isInitial()) doInit();
doStart();
}
} | 2 |
public String name()
{
return name;
} | 0 |
@Override
public String toString() {
return "fleming.entity.Hospital[ idHospital=" + idHospital + " ]";
} | 0 |
public int peekBitToInt(int val, int bit) throws IOException {
while (true) {
if (bit < availBits) {
val <<= 1;
if ((getBit + bit) >= BITS_PER_BLURB) {
bit = (getBit + bit) % BITS_PER_BLURB;
val |= ((buffer[getByte + 1] & (0x80 ... | 5 |
private void cleaningText() {
int latinCount = 0, nonLatinCount = 0;
for(int i = 0; i < text.length(); ++i) {
char c = text.charAt(i);
if (c <= 'z' && c >= 'A') {
++latinCount;
} else if (c >= '\u0300' && UnicodeBlock.of(c) != UnicodeBlock.LATIN_EXTEND... | 9 |
public void calculateHappiness(int totalWins, int totalLosses) {
if (totalWins == 0 || totalLosses == 0) {
System.out.println("Insufficient Data.");
} else if (totalWins > totalLosses) {
System.out.println("Yay! You're winning more than you're losing, you "
+ "must be happy.\... | 5 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
CommandContext cc = new CommandContext(sender, cmd, alias, args, annot);
try {
return (Boolean)mcommand.invoke(cmdinstance, cc);
} catch (ReflectiveOperationException e) {
throw new CommandException("... | 1 |
private boolean hasTag(String version)
{
for (final String string : Updater.NO_UPDATE_TAG) {
if (version.contains(string)) {
return true;
}
}
return false;
} | 2 |
private static void createAndShowGUI() {
//Create and set up the window.
frame = new JFrame("Towers of Hanoi");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set up the content pane.
addComponentsToPane(frame.getContentPane());
//Use the content pane's default ... | 0 |
public int getAdjacentAntsBlack() {
return adjacentAntsBlack;
} | 0 |
public static int getNextId(Class<? extends BaseEntity> clazz) {
if (!ID_MAP.containsKey(clazz)) {
resetIDtoZero(clazz);
}
return ID_MAP.get(clazz).getAndIncrement();
} | 2 |
public static void main(String[] args) {
Implementor implementorA = new ConcreteImplementorA();
Abstraction abstractionA = new RefinedAbstractionA(implementorA);
Implementor implementorB = new ConcreteImplementorB();
Abstraction abstractionB = new RefinedAbstractionA(implementorB);
implementorA.operation();... | 0 |
boolean canAccommodate(CommentText comment) {
// always accommodate if empty
if (comments.size() == 0) {
return true;
}
// cannot accommodate if the last marker was \j, \l, \r, \c, \s
if (lastMarker.equals(ALIGN_LEFT_MARKER) || lastMarker.equal... | 8 |
@Override
public void controlPressed(Command c) {
BasicCommand b = (BasicCommand) c;
switch(b.getName()) {
case "UP":
model.up();
break;
case "DOWN":
model.down();
break;
case "LEFT":
model.left();
break;
case "RIGHT":
model.right();
break;
... | 5 |
private <T> ObjectConstructor<T> newDefaultConstructor(Class<? super T> rawType) {
try {
final Constructor<? super T> constructor = rawType.getDeclaredConstructor();
if (!constructor.isAccessible()) {
constructor.setAccessible(true);
}
return new ObjectConstructor<T>() {
@Sup... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bigram other = (Bigram) obj;
if (lastPos == null) {
if (other.lastPos != null)
return false;
} else if (!lastPos.equals(other.lastPos))
... | 9 |
public void closeConnection() {
try {
if (e != null && e.isOpen()) {
e.close();
}
} catch (IllegalStateException e) {
e.printStackTrace();
}
if (fac != null && fac.isOpen()) {
fac.close();
}
} | 5 |
@Override
public void run() {
requestFocus();
long lastTime = System.nanoTime();
final double numTicks = 60.0;
double nanoSeconds = 1000000000 / numTicks;
double delta = 0;
int frames = 0;
int ticks = 0;
long timer = System.currentTimeMillis();
... | 3 |
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.