text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int compare(Object arg1, Object arg2)
{
Point p1 = (Point) arg1;
Point p2 = (Point) arg2;
if (p1.x > p2.x) return 1;
else if(p1.x == p2.x)
{
if (p1.y > p2.y) return 1;
else if (p1.y == p2.y) return 0;
}
return -1;
} | 4 |
private void halveArraySize() {
Person[] smallerArray = new Person[(personArray.length/2)];
for (int i = 0; i < (personArray.length/2); i++) {
smallerArray[i] = this.personArray[i];
}
this.personArray = smallerArray;
} | 1 |
@Override
public boolean canAttack(Board board, Field currentField, Field occupiedField) {
return this.validSetupForAttack(currentField, occupiedField) && occupiedField.distanceBetweenRank(currentField) == this.forwardDistance(1) && Math.abs(occupiedField.distanceBetweenFile(currentField)) == 1;
} | 2 |
public void exec() {
List<Double> annOut = network.run();
if (annOut.get(0) > .5 && annOut.get(1) <= .5) {
headingDelta = 5;
movement = 0;
hunger += .0009;
} else if (annOut.get(0) > .5 && annOut.get(1) > .5) {
headingDelta = 0;
movement = 3;
hunger += .0009;
} else if (annOut.get(0) <= .5 && ... | 6 |
public boolean configureFor(int stage) {
if (stage == STAGE_GET_SEED) {
toPlant = findPlantTile(actor, nursery) ;
if (toPlant == null) { abortBehaviour() ; return false ; }
if (nursery.stocks.amountOf(seedMatch()) > 0) {
this.stage = STAGE_GET_SEED ;
}
else this.stage = STAGE_P... | 5 |
public void feedCitiesProcessDisasters() {
players.get(currentplayer).feedCities();
players.get(currentplayer).processDisasters();
int numSkulls = players.get(currentplayer).getSkulls();
if (numSkulls == 3) {
for (int i = 0; i < players.size(); i++) {
if (i != currentplayer || players.size() == 1) {
... | 8 |
@Override
public String toString() {
return "{id=" + id +"}";
} | 0 |
public void testPropertySetMinute() {
Partial test = new Partial(TYPES, VALUES);
Partial copy = test.property(DateTimeFieldType.minuteOfHour()).setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 12, 30, 40);
try {
test.property(DateTimeFieldType.minute... | 2 |
protected void load() {
boolean loaded = false;
try {
load(file);
loaded = true;
}
catch (final FileNotFoundException e) {}
catch (final IOException e) {
plugin.logException(e, "cannot load " + file);
}
catch (final InvalidConfigurationException e) {
if (e.getCause() instanceof YAMLException) ... | 9 |
public Integer getQuantity() {
return quantity;
} | 0 |
public Timestamp getModifyDateGmt() {
return this.modifyDateGmt;
} | 0 |
protected void verifySignature(RandomAccessFile randomaccessfile) throws IOException, InvalidLodFileException
{
randomaccessfile.seek(0L);
boolean matchedSignature = true;
for (int i = 0; i < SIGNATURE_NEW_MM7.length; i++)
{
int aByte = randomaccessfile.read();
... | 9 |
protected String getGlobalLinkerFlags() {
final StringBuilder builder = new StringBuilder();
if (globalOverrideLinkerFlags == null
|| globalOverrideLinkerFlags.isEmpty()) {
if (parent != null)
builder.append(parent.getGlobalLinkerFlags());
else
builder.append(config.ldflags());
} else {
build... | 8 |
public FieldMetadata getNamedField(final String fieldName) {
if (StringUtils.isBlank(fieldName)) return null;
for (FieldMetadata field : fields) {
if (field.getName().equals(fieldName)) return field;
}
return null;
} | 3 |
private String startTimeToString()
{
long start = this.videoSection.getStart();
if (videoSection.getTimeUnit() == TimeUnit.SECONDS)
{
start *= 1000;
}
int millisecond = (int) (start % 1000);
start /= 1000;
int second = (int) (start % 60);
s... | 1 |
public int dijkstra(int s, int t) {
for (int i = 0; i < cost.length; i++) {
dis[i] = INF;
vis[i] = false;
}
PriorityQueue<Edge> q = new PriorityQueue<Edge>();
q.add(new Edge(s, 0, -1));
dis[s] = 0;
while (!q.isEmpty()) {
Edge u = q.poll();
if (u.id == t)
return u.w;
for (int j... | 7 |
@Override
public Clip getSoundClip(EnActionResult actionResult) {
if (moveClip == null) {
moveClip = openClip(SoundPlayerWav.SOUND_MOVE);
}
if (treasureClip == null) {
treasureClip = openClip(SoundPlayerWav.SOUND_TREASURE);
}
if (winClip == null) {
... | 7 |
public int aroonOscLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod;
} | 3 |
public String getGameStateName(){
String stateName;
switch(gameState){
case 0:
stateName = "New hand";
break;
case 1:
stateName = "Fold";
break;
case 2:
stateName = "Bet";
... | 7 |
public Word getAnswer(String s){
Iterator<Word> iterator = list.iterator();
Word w = null;
boolean flag = false;
while (iterator.hasNext()){
w = iterator.next();
if (w.getEWord().equals(s)){
System.out.println(w);
flag = true;
... | 3 |
public void setIautosSellerInfo(IautosSellerInfo iautosSellerInfo) {
this.iautosSellerInfo = iautosSellerInfo;
} | 0 |
private void fetchAttributes() {
int len = GL20.glGetProgrami(program, GL20.GL_ACTIVE_ATTRIBUTES);
// max length of all uniforms stored in program
int strLen = GL20.glGetProgrami(program, GL20.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);
attributes = new Attrib[len];
for (int i = 0; i < len... | 1 |
private static boolean formQueryHotel(Criteria crit, List params, StringBuilder sb, StringBuilder sbw, Boolean f2345, Boolean f5) {
List list = new ArrayList<>();
StringBuilder str = new StringBuilder(" ( ");
String qu = new QueryMapper() {
@Override
public String mapQuer... | 4 |
Level(GameEngine eng, String file_prefix) {
priority = -1;
engine = eng;
try {
layout = ImageIO.read(new File(file_prefix + ".layout.png"));
visual = ImageIO.read(new File(file_prefix + ".visual.png"));
LevelGeometry g = new LevelGeometry(engine, layout, visua... | 8 |
public static ArrayList<Media> getAllRentedMedia() {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Media> mediaList = new ArrayLis... | 5 |
public String getAccessString() {
StringBuffer sb = new StringBuffer();
if (AccessFlags.isPublic(this.accessFlags))
sb.append("public ");
if (AccessFlags.isPrivate(this.accessFlags))
sb.append("private ");
if (AccessFlags.isProtected(this.accessFlags))
... | 8 |
public void attackClosestUnit() {
ArrayList<Cell> attackableCells = getAttackableCells(map);
if (attackableCells.size() == 0) {
map.resetPreviousCells();
Queue<Cell> queue = new LinkedList<Cell>();
queue.add(this.getCell());
ArrayList<Cell> expandedNode... | 8 |
public static void dfsCat() {
Stack<Integer> s = new Stack<Integer>();
s.push(hcat);
vcat[hcat] = true;
while (!s.isEmpty()) {
int cur = s.pop();
for (int i = 0; i < gcat[cur].size(); i++) {
int neigh = gcat[cur].get(i);
if (!vcat[neigh]) {
vcat[neigh] = true;
s.push(neigh);
}
}
... | 3 |
public String encrypt (String input) {
//Below checks whether the string contains any digit characters
if(input.matches(".*\\d.*")) throw new IllegalArgumentException();
//Below the replaceAll is used to ignore non-characters until first appearance of a character
String formatted = input.toUpperCase().replaceAll("[... | 9 |
private static void intersectFrom(Scope scope1, Scope scope2,
Set<String> matchedNames,
Collection<Variable> vars) {
Set<Variable> privates1 = scope1.mPrivateVars;
Variable[] vars1 = scope1.getLocallyDeclaredVariables();
... | 9 |
public void playGame() {
while (!isOver()) {
showTrack();
move();
}
showTrack();
showWinners();
} | 1 |
public int hashCode() {
int code = 0;
for (final E item : this) {
code = code ^ item.hashCode();
}
return code;
} | 1 |
public List<String> getNameCombinations() {
List<String> nameComb = new ArrayList<String>();
nameComb.add(getLastName() + ", " + getFirstName() + " "
+ getMiddleName());
nameComb.add(getFirstName() + " " + getMiddleName() + " "
+ getLastName() + " " + getSuffix());
return nameComb;
} | 0 |
private static void Transform(int i, int[] buffer, int messageLenBytes, byte[] message, byte[] paddingBytes, int[] state) {
int index = i << 6;
for (int j = 0; j < 64; j++, index++) {
buffer[j >>> 2] = ((int) ((index < messageLenBytes) ? message[index] : paddingBytes[index - messageLenBytes]... | 7 |
public static StandardObject lookupVariableType(Symbol variablename) {
{ StandardObject entry = ((((KeyValueList)(Stella.$LOCALVARIABLETYPETABLE$.get())) != null) ? ((StandardObject)(KeyValueList.lookupVariableTable(((KeyValueList)(Stella.$LOCALVARIABLETYPETABLE$.get())), variablename))) : ((StandardObject)(null)))... | 8 |
public static void choldc_f77(int n, double a[][], double diagmx,
double tol, double addmax[]) {
/*
Here is a copy of the choldc FORTRAN documentation:
SUBROUTINE CHOLDC(NR,N,A,DIAGMX,TOL,ADDMAX)
C
C PURPOSE
C -------
C FIND THE PERTURBED L(L-TRANSPOSE) [WRITTEN LL+] DECOMPOSIT... | 8 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if(tickUp==1)
{
if(success==false)
{
final StringBuffer str=new StringBuffer(L("You get distracted from your search.\n\r... | 7 |
public static void main(String[] args) throws IOException {
byte[] b = new byte[16];
for(int i = 0 ; i < b.length;i ++)
{
b[i] = (byte)i;
}
MyOwnStream1 mosrm = new MyOwnStream1(b);
//指定下次读取的位置
mosrm.mark(3);
//需要用reset方法来重置下次读取的位置为mark指定的位置
mosrm.reset();
while(true)
{
int c =... | 3 |
public IDassign(String type) {
this.nextIDchar = new Character[type.length()];
Pattern patrn = Pattern.compile("[...a-z_]");
Matcher match = patrn.matcher(type);
for (int i = 0; i < 3; i++) {
if (i == 1) {
patrn = Pattern.compile("[...A-Z_]");
match = patrn.matcher(type);
}
else if (i == 2) ... | 9 |
public void build(AssemblyType type) {
Mass one;
Mass two;
double restLength;
double constant;
NodeList nodes = myDoc.getElementsByTagName(SPRING);
for (int i = 0; i < nodes.getLength(); i++) {
restLength = -1;
constant = 1;
Node springItem = nodes.item(i);
NamedNodeMap nodeMap = springItem.getA... | 2 |
public Component getEditorComponent(final PropertyEditor editor)
{
String[] tags = editor.getTags();
String text = editor.getAsText();
if (editor.supportsCustomEditor())
{
return editor.getCustomEditor();
}
else if (tags != null)
{
// m... | 5 |
private static void printGridletList(GridletList list, String name,
boolean detail)
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
System.out.println();
System.out.println("============= OUTPUT for " + name ... | 3 |
JobFuturePair(PageJob job, Future<?> future) {
this.job = job; this.future = future;
} | 1 |
public void onJoin(String channel, String sender, String login, String hostname) {
if (!sender.equals(bot.getNick())) {
if (status == GameStatus.PRE)
sendNotice(sender, getFromFile("GAME-STARTED", NOTICE));
else if (status != GameStatus.IDLE)
sendNotice(sender, getFromFile("GAME-PLAYING", NOTICE));
}
... | 3 |
public static void main(String[] args)
{
// 只能在List下面的类型
GenericTestExtends<? extends List> ge = null;
//引用指向不同类
ge = new GenericTestExtends<ArrayList>();
ge = new GenericTestExtends<LinkedList>();
// ge = new GenericTestExtends<HashMap>();
// 只能在List上面的类型
GenericTestExtends<? super List> ge2 = n... | 3 |
@Override
public void mousePressed(final MouseEvent e) {
// if handler is clicked don't do anything
for (final Element el : getGraphicPanel().getSelectionManager().getSelectedElements()) {
if (el.getComponent().getHandlers().isHandlerAt(e.getPoint())) {
System.out.println... | 5 |
public boolean isBlockTile(Block block) {
Set<Integer> tilesKeys = tilesLocations.keySet();
SerializableLocation blockLocation = new SerializableLocation(block.getLocation());
for(Integer key : tilesKeys) {
for(int i = 0; i < tilesLocations.get(key).size(); ++i) {
SerializableLocation keyBlockLocation = ti... | 3 |
public boolean checkhit(Coord c) {
init();
if (spr != null)
return (spr.checkhit(c));
return (false);
} | 1 |
@Override
public void keyReleased(KeyEvent arg0)
{
if (arg0.getKeyCode() == KeyEvent.VK_W || arg0.getKeyCode() == KeyEvent.VK_A || arg0.getKeyCode() == KeyEvent.VK_S || arg0.getKeyCode() == KeyEvent.VK_D)
{
if (arg0.getKeyCode() == KeyEvent.VK_W)
{
playerAction("halt", "U");
}
if (arg0.g... | 9 |
public void update(GameContainer gc, Player player, int deltaT) {
float rotateSpeed = 0.06f;
Input input = gc.getInput();
if (input.isKeyDown(Input.KEY_Q) && angle < 90) {
angle += rotateSpeed * deltaT;
} else if (input.isKeyDown(Input.KEY_E) && angle > 2) {
angle -= rotateSpeed * deltaT;
}
x = Ma... | 4 |
public boolean equals(Vector3f r) {
return x == r.getX() && y == r.getY() && z == r.getZ();
} | 2 |
public Entradas getEntradasIdEntrada() {
return entradasIdEntrada;
} | 0 |
public synchronized void actualiza(long tiempoTranscurrido) {
if (cuadros.size() > 1) {
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal) {
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
... | 3 |
@Override
public void pop() {
if (amount != 0) {
for (int i = 0; i < amount + 1; i++) {
stack[i] = stack[i + 1];
}
amount--;
}
} | 2 |
private static List<URL> getJarUrls(String jarString, Shell shell) {
String[] jars = jarString.split(";");
List<URL> urls = new ArrayList<URL>();
if (jars != null) {
for (int i = 0; i < jars.length; i++) {
String jar = jars[i];
if (jar != null && !"".equals(jar.trim())) {
try {
URL url = new... | 5 |
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
GUI.init();
System.out.println("...SOS...");
String in = GUI.askString("Connection setup", "To join a game, type an ip address. To host one, type \"host\"");
Render.loadStep = "Loading resources...";
new Thread(ne... | 8 |
public static Borne getBorneById(int id_borne) {
Borne borne = null;
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from borne where id_borne="+ id_bo... | 3 |
@Override
public String toString() {
StringBuilder movieString = new StringBuilder();
Iterator<String> it = keywords.iterator();
Iterator<String> actorIterator = actorList.iterator();
movieString.append("-Movie- \n").append("director: ").append(director).append('\n');
movieS... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PingMessage other = (PingMessage) obj;
if (correlationId == null) {
if (other.correlationId != null)
return false;
} else if (!correlati... | 9 |
public void insertWord(String word) {
//Start at root
TrieNode curNode = root;
//loop through each char in the string
for (char c : word.toCharArray()) {
//get the index of where the string should be stored in the children array
int index = getIndex(c);
//if -1 then the char is invalid
if (index != ... | 4 |
private void gameKeyPressed(int key){
switch(key){
case KeyEvent.VK_W:
//UP
break;
case KeyEvent.VK_S:
//DOWN
break;
case KeyEvent.VK_A:
//LEFT
mainModel.wilbert.moveLeft();
break;
case KeyEvent.VK_D:
//RIGHT
mainModel.wilbert.getBody().applyLinearImpulse(new Vec2(0.01f, 0.0f),main... | 9 |
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (!(o instanceof Pair)) {
return false;
} else {
Pair<?, ?> oP = (Pair<?, ?>) o;
return (key == null ?
oP.getKey() == null :
... | 9 |
public final Hashtable<Integer,Integer> distributionOff() {
final Hashtable<Integer,Integer> offd = new Hashtable<Integer,Integer>();
for (int m=0; m<this.m; m++) {
final Integer key = off[m].size();
Integer value = offd.get(key);
if (value==null) offd.put(key, value);
else value++;
}
return offd;
... | 2 |
* @param row
* The row of the bracket to match.
* @param col
* The column of the bracket to match.
* @param match
* The BracketMatch instance for this match attempt.
*/
private void findMatchForward(int row, int col, BracketMatch match) {
int y = row;
i... | 7 |
public static void hm_main(String args[]){
int map_type = Integer.parseInt(args[0]);
int NUM_THREADS = Integer.parseInt(args[1]);
int init_capacity = Integer.parseInt(args[2]);
int load = Integer.parseInt(args[3]);
System.out.println("Running with " + NUM_THREADS + " threads.");
System.out.println("Runni... | 8 |
@Test
public void test_insertions() {
int m = 3;
int n = 5;
Matrix m1 = new MatrixArrayList(m, n);
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
m1.insert(i, j, (double) (i * j));
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
assertEquals(m1.get(i, j), (double)... | 4 |
public boolean GetHasMemory()
{
return hasMemory;
} | 0 |
public static void generateNewPopulation( Individual[] pop )
{
sumFitness = 0;
for( int i=0; i<POPULATION_SIZE; i++ )
sumFitness += pop[i].fitness;
generation[ currentGeneration++ ] = sumFitness / POPULATION_SIZE;
Individual[] tempGen = new Individual[POPULATION_SIZE];
for( int i=0; i<POPULATION... | 3 |
public void keyPressed(final KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT)
moveXcoord = -game.speed;
if (e.getKeyCode() == KeyEvent.VK_RIGHT)
moveXcoord = game.speed;
if (e.getKeyCode() == KeyEvent.VK_UP)
moveYcoord = -game.speed;
if (e.getKeyC... | 4 |
private void strize(){
for(int i=0; i<m;i++)
{
stolbiki[i] = new Stolbec(n);
for(int j=0; j<n; j++){
stolbiki[i].setone(j, stroki[j].get(i) );
}
}
} | 2 |
public int countSquares(String[] field){
n = field.length;
m = field[0].length();
map = field;
int result = 0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
for(int u=i; u<n; u++){
for(int v=j+1; v<m; v++){
... | 9 |
public static Polynomial getIrreducible(final int degree, final int start) {
int test = start;
Polynomial polynomial = new Polynomial(test);
while(polynomial.getWeight() % 2 == 0 || !polynomial.isMonomial() || polynomial.getDegree() < degree || !polynomial.isIrreducible()) {
test++;
... | 5 |
private void helpPressed() {
if (getTray() == null ||
fHelpButton != null && fHelpButton.getSelection()) { // help button was not selected before
if (getShell() != null) {
Control c = getShell().getDisplay().getFocusControl();
while (c != null) {
if (c.isListening(SWT.Help)) {
c.notifyListen... | 8 |
@Override
public boolean hasNext() {
return Math.abs( x - line.getX2()) > 0.9 || ( Math.abs(y - line.getY2()) > 0.9);
} | 1 |
public static boolean isVersionLessThan(String isThis, String lessThanThis){
int A[] = parseVersion(isThis);
int B[] = parseVersion(lessThanThis);
if(A[0] < B[0]){
return true;
}
if(A[0] == B[0]){
if(A[1] < B[1]){
return true;
}
if(A[1] == B[1]){
if(A[2] < B[2]){
return true;
}
... | 7 |
public static PartitionMetadata findLeader(Collection<BrokerReference> replicaBrokers, Collection<BrokerReference> seedBrokers, String topicId, int partitionId) {
PartitionMetadata returnMetaData = null;
loop:
for (BrokerReference seed : seedBrokers) {
SimpleConsumer consumer = null;
try {
consumer ... | 8 |
static Object redirect(Object proxy, InvocationHandler handler, Method m, Object... args) throws Throwable
{
try
{
return handler.invoke(proxy, m, args);
}
catch(Throwable t)
{
if(t == null)
{
throw new Exception("An excepti... | 6 |
public void move(int Direction , int Delta) {
if(y < Game.HEIGHT - 32) {
if(Direction == 3) {
dir = 3;
y += pace;
currentLengthD += pace;
}
}
if(x > 0) {
if(Direction == 1) {
dir = 1;
x -= pace;
currentLengthL += pace;
}
}
if(x < Game.WIDTH - 32) {
if(Dire... | 8 |
public FillResult tryFillCanvas(TextMetaInfo textInfo,
StyleConfig styleConfig) {
FillResult result = new FillResult();
int maxCanvasHeight = styleConfig.getCanvasHeight();
// 所有textLine取出来,算出最高的
// 在这里用set过滤掉指向相同文本的textLine,相同文字的图片块在画布上只绘制一次
Set<TextLine> textLineList = new HashSet<TextLine>();
int maxL... | 7 |
public void configureAndShow(JoeTree tree) {
configure(tree);
super.show();
} | 0 |
private void btn_eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_eliminarActionPerformed
final int row = this.table_ticket.getSelectedRow();
if (row >= 0) {
final Ticket tic = this.tableTicketModel.getTicket(row);
int i = JOptionPane.showConfirmDial... | 3 |
public static void testDictionary(String apiKey) throws NetworkException, AnalysisException {
DictionaryManager dictionaryManager = new DictionaryManager(apiKey);
// Delete all dictionaries in our account.
{
for (Dictionary dict : dictionaryManager.allDictionaries()) {
System.out.println("Deleting curren... | 5 |
public void delLines(int[] indexRows)
{
// modif bellier.l - merci pour le code
//la fonction remove d'une arraylist effectue également un rétractage
//indiceRow contient des indices "erronés" d'où l'intéret de delay
for (int i = indexRows.length - 1; i >=0 ; i--) {
ob... | 1 |
@Override
public BeerReadOnly getBeer(String beerId) {
return persistenceService.get(beerId);
} | 0 |
@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 Mitglied)) {
return false;
}
Mitglied other = (Mitglied) object;
if ((this.id == null && other.id != null) || (... | 5 |
public static void main(String[]args){
FabrykaKomputerow fabrykaKomputerow = new FabrykaKomputerow();
System.out.println("PC");
Komputer pc = fabrykaKomputerow.wydajKomputer("PC");
System.out.println("\n\nLaptop");
Komputer laptop = fabrykaKomputerow.wydajKomputer("Laptop");
} | 0 |
public void addEvent(Event e)
{
events.add(e);
} | 0 |
public static Map<String, String> simpleCommandLineParser(String[] args) {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i <= args.length; i++) {
String key = (i > 0 ? args[i - 1] : null);
String value = (i < args.length ? args[i] : null);
if (key == null || key.star... | 9 |
public static boolean wordBreak(String s, Set<String> dict) {
if(dict.size() <=0) return false;
Pattern pattern;
Matcher matcher;
Iterator<String> iterator=dict.iterator();
while(iterator.hasNext()){
pattern=Pattern.compile(iterator.next());
matcher= pattern.matcher(s);
s=matcher.replaceAll("");
}
... | 3 |
public final void setUnitPrice(double unitPrice) {
if(unitPrice < 0) {
throw new IllegalArgumentException();
}
this.unitPrice = unitPrice;
} | 1 |
@Basic
@Column(name = "CSA_CANTIDAD")
public int getCsaCantidad() {
return csaCantidad;
} | 0 |
public void validate(final Object object, final Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "Cannot be empty", "Cannot be empty");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "Cannot be empty", "Cannot be empty");
} | 0 |
@Override
public Dimension getPreferredContentSize() {
int width = 0;
int height = 0;
int dividerHeight = getRowDividerHeight();
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
height += getRowHeight(row) + dividerHeight;
}
for (TreeColumn column : mColumns) {
width += column... | 3 |
public Productos() {
initComponents();
mostrarProductosTabla();
} | 0 |
public Production[] getAnswer()
{
/* Collections.sort(myAnswer, new Comparator<Production>(){
public int compare(Production o1, Production o2) {
return (o2.getRHS().length()-o1.getRHS().length());
}
});
*/
Production[] answer=new Production[myAnswer.size()];
for (i... | 1 |
public void connect() {
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
//builder.socketTimeout(0);
builder.socketKeepAlive(true);
boolean notConnected = true;
while (notConnected && !shutdown) {
try {
Utils.printWithDate("Connect to MongoDB at " + hostname + " (Port " + p... | 5 |
@Test
public void testSphereColliding(){
// spheres at an arbitrary location and is obviously not colliding
Sphere s4441 = new Sphere(new Vector3f(4.0f,4.0f,4.0f),1.0f);
Sphere s8881 = new Sphere(new Vector3f(8.0f,8.0f,8.0f),1.0f);
Sphere s0004 = new Sphere(new Ve... | 3 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_P) { //Presiono letra P
pausa = !pausa; //cambio valor de pausa
}
if (e.getKeyCode() == KeyEvent.VK_LEFT) { //Presiono flecha izquierda
barra.setDireccion(1);
}
if (e.getKeyCode() =... | 7 |
private int readUInt8(byte[] uint16, int offset) throws IOException {
int b0 = uint16[0 + offset] & 0x000000FF;
return b0;
} | 0 |
public static Tree decisionTreeLearning(
ArrayList<HashMap<String, String>> examples,
ArrayList<String> attributes, String goalAttribute,
HashMap<String, String[]> attributeValues,
ArrayList<HashMap<String, String>> parentExamples) {
print("Attributes: " + attributes);
print("Examples: " + examples);
... | 6 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.