method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b26c01f0-7ced-4fa5-855d-f02c4a8e0e0c | 9 | public Message(String rawMessage){
prefix = "";
command = "";
trailing = "";
parameters = new ArrayList<String>();
/*
* parse optional prefix.
* we know we have a prefix when there is a ':' leading the message
*/
if(rawMessage.startsWith(":")){... |
b72acc30-11fd-4763-b900-34ec16e8e5fd | 9 | protected void addPanel(JComponent panel, Screen screen)
{
cardPanel.add(panel, screen.name());
switch (screen)
{ case CAMPUS:
campus = (CampusPanel)panel;
campus.sendFrame(this);
break;
case CLASS:
classroom = (ClassroomPanel) panel;
break;
case MINISPLASH:
miniSplash = (MiniSpl... |
68d3b3e2-c838-4390-a9e9-27e6780e9962 | 8 | public int func_78337_a(StatCrafting par1StatCrafting, StatCrafting par2StatCrafting)
{
int i = par1StatCrafting.getItemID();
int j = par2StatCrafting.getItemID();
StatBase statbase = null;
StatBase statbase1 = null;
if (slotStatsItemGUI.field_77264_j == 0)
{
... |
c79d52fa-ea33-4bd2-9554-caf040de52d2 | 3 | public void paintComponent(Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint gp = new GradientPaint(0, 0,
new Color(70,70,70), 0, getHeight(),
new Color(50,50,50))... |
c1f8ec8f-99eb-4fa6-ab03-feef877610d1 | 1 | public void updateType() {
Type subType = Type.tSuperType(subExpressions[0].getType())
.intersection(Type.tArray(type));
if (!(subType instanceof ArrayType))
updateParentType(Type.tError);
else
updateParentType(((ArrayType) subType).getElementType());
} |
7fb77e36-5b46-4072-b6c3-30d802f81e82 | 9 | public void calcuateTFIDF(BufferedReader oBufferedReader)
throws IOException {
Hashtable<String, Integer> oTermVsTF = new Hashtable<String, Integer>();
String strLine = null;
while ((strLine = oBufferedReader.readLine()) != null) {
if (strLine.trim().startsWith("<narr>"))
totalDocs++;
if (strLine.sta... |
1e7d5b15-4685-4098-b239-d133742efd5a | 7 | public Digraph reverse()
{
Digraph R = new Digraph(V());
for (int v = 0; v < V(); v++)
for (int w : adj(v))
try
{
R.addEdge(w, v);
}
catch (Exception e)
{
// No Exception can arise as R is being constructed from a
// valid DG
assert (v < 0 || v >= V() || w < 0 || w >= V()... |
a539fb77-e945-4b88-9118-f4801da1afbe | 7 | public void savePlayer(War3Player player){
addPlayer(player);
FileOutputStream fo = null;
BufferedWriter bw = null;
try {
fo = new FileOutputStream(new File(this.playersDataFilePath));
bw = new BufferedWriter(new OutputStreamWriter(fo));
bw.write(group... |
140cf47a-9894-4587-848b-45a6294d9539 | 6 | final void F(int i, int i_370_) {
int i_371_ = i_370_ * ((SoftwareToolkit) this).maxWidth + i;
int i_372_ = i_370_ * anInt7495 + i;
if (i_371_ != 0 || i_372_ != 0) {
int[] is = ((SoftwareToolkit) this).pixelBuffer;
float[] fs = ((SoftwareToolkit) this).aFloatArray7511;
if (i_371_ < 0) {
int i_373_ =... |
ae43a2c5-5777-4314-abc2-07b016667c28 | 3 | public int parseObject(Object o) throws IOException, InterruptedException
{
if(o instanceof Command )
{
Command command = (Command)o;
System.out.println("load balancer thread " + command);
System.out.println(LoadBalancer.getNode(command.key));
... |
4b87fffb-4346-4d7a-a15b-75b0c0d8d92a | 3 | public static void main(String[] args) {
List<Shape> shapeList = Arrays.asList(new Circle(), new Square(),
new Triangle());
for (Shape shape : shapeList)
shape.draw();
// Rhomboid 转型测试
Rhomboid rhomboid = new Rhomboid();
if (rhomboid instanceof Shape) {
Shape shape = rhomboid;
shape.draw();
... |
c30feda1-48f0-41e4-baa2-44e95d1af889 | 8 | public void keyPressed(KeyEvent arg0) {
switch(arg0.getKeyCode()){
case left:
case a:
lDown.set(2);
break;
case right:
case d:
rDown.set(2);
break;
case up:
case w:
uDown.set(2);
break;
case down:
case s:
dDown.set(2);
break;
}
} |
7a3dcf7a-867f-4fd5-a31a-e2dfafd9bfb6 | 0 | @Override
public String getID() {
return super.getID();
} |
667869a7-0f5d-45b0-a814-12cb4a2b8c42 | 5 | private void logicSaveFile() {
JFileChooser jfc = new JFileChooser();
jfc = setFilters(jfc, true, "sintax file (*.stx)", "stx");
jfc.setMultiSelectionEnabled(false);
jfc.setVisible(true);
boolean repeat = true;
int Guardar;
do {
Guardar = jfc.showSaveD... |
92ac1cb5-482c-4afa-896b-ec03930b79d0 | 4 | public void solve() {
canContinue = false;
char currentValue;
for (int j = 0 ; j < 9 ; j++) {
for (int i = 0; i < 9 ; i++) {
currentValue = getGridModel().getValue(i, j);
if (currentValue == ' ') {
compareRow(i,j);
... |
380bbe36-1f19-4023-b905-196217c7c978 | 9 | public Rota atualizarStatusRotas(Rota rota){
/*//se a rota nao chegou no destino que deveria deve ser excluida
if(!rota.getLastPontoDestino().equalsIgnoreCase(pontoDestino)){
rotasParaSeremExcluidas.add(rota);
}*/
if(rota.getLastPontoDestino().equalsIgnoreCase(rota.getPontoDestino())){
rota.concluir... |
48342a65-16d8-44b8-976c-d29b306f652c | 7 | private void setupNextMove()
{
// moveLog = "";
// gray pieces removed at each turn
deleteSacrifices();
move = new Move(board);
// available captures?
if (getCaptureStartPoints(move))
{
state = NEED_CAPTURE_START;
}
else
{
getPaikaStartPoints();
state = NEED_PAIKA_START;
}
// check... |
9598e950-8cac-459b-b170-c8dd9d6261d9 | 8 | public static boolean getIs64BitOperatingSystem() {
java.lang.String s = System.getenv("PROCESSOR_ARCHITEW6432");
if (s != null && s.contains("64"))
return true;
s = System.getenv("PROCESSOR_ARCHITECTURE");
if (s != null)
return s.contains("64");
if (Environment.isUnix() || Environment.isMac())
{
... |
ca9c077d-19db-4f33-8f8d-59775d1121cb | 8 | private void confirm() {
if (rb1A.isSelected())
typeOfA = Element.ID_NT;
else if (rb1B.isSelected())
typeOfA = Element.ID_PL;
else if (rb1C.isSelected())
typeOfA = Element.ID_WS;
else if (rb1D.isSelected())
typeOfA = Element.ID_CK;
if (rb2A.isSelected())
typeOfB = Element.ID_NT;
else if (rb... |
f688023e-5035-4e7e-9338-5b34061764e5 | 4 | private void sortToDoItems() {
switch (sorting) {
case TITLE:
Collections.sort(this.displayList.getList(), new TitleComparator());
break;
case CATEGORY:
Collections.sort(this.displayList.getList(), new CategoryComparator());
... |
bf7b9d3f-e253-4e76-b745-548380afd9d1 | 8 | @Override
@SuppressWarnings("rawtypes") // for instanceof
public boolean equals(Object o) {
if (!(o instanceof Map.Entry)) return false;
Map.Entry<?,?> e2 = (Map.Entry<?,?>) o;
return (mKey==null
? e2.getKey()==null
: mKey.equal... |
ffc748d8-3143-46cb-b8cb-561a2608627d | 4 | public void stop() {
try {
if ( console != null ) console.close();
if ( streamOut != null ) streamOut.close();
if ( socket != null ) socket.close();
} catch( IOException ioe ) {
System.out.println("Error closing ...");
}
} |
499ad4de-2439-450b-acab-ac223da68758 | 1 | public static void main(String[] args){
BigInteger a = new BigInteger("1");
BigInteger b = new BigInteger("1");
int index = 2;
while(b.toString().length()<1000){
BigInteger temp = b.add(a);
a = b;
b = temp;
index++;
}
System.out.println(index);
} |
66eb384c-eea5-4710-88da-b9029949865f | 8 | @Override
public void removeComponent(Component component)
{
if(component instanceof InteractableContainer) {
InteractableContainer container = (InteractableContainer)component;
if(container.hasInteractable(currentlyInFocus)) {
Interactable original = currentlyInF... |
887a96cc-e7b1-4629-a616-c0d822ff929d | 4 | public Combo_Box_Remove_Appointment() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | Remove Appointment");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(n... |
2800e6c5-b507-4155-a9b9-82cb8e9ac378 | 4 | public LinkedList<Integer> getAdjList() {
LinkedList<Integer> adjList = new LinkedList<Integer>();
if(this.top != null) adjList.add(this.top);
if(this.right != null) adjList.add(this.right);
if(this.bottom != null) adjList.add(this.bottom);
if(this.left != null) adjList.add(this.left);
return adjList;
} |
12a127f8-3e72-4803-96fe-cbb95e01cb85 | 1 | @Override
public void run() {
count ++;
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("runnableImpl print:" + count);
} |
70ffbf4d-f80b-4ee2-87a7-82668269fe19 | 3 | private HtmlElementType(Class<? extends HtmlElement> clazz, boolean hasCloseTag, HtmlTokenizerState switchTo){
Constructor<? extends HtmlElement> c;
try {
c = clazz.getConstructor(HtmlMidNode.class, HtmlAttributeToken[].class);
} catch (NoSuchMethodException | SecurityException e) {
assert false : e ;
c... |
1528ee92-cc7a-4f99-8e3d-042d3a4573c6 | 6 | private void exportInventory(CompoundTag tag)
{
List<Tag> list = new ArrayList<Tag>();
for (byte i = 0; i < Inventory.length; i++)
{
if (Inventory[i] == null)
continue;
Tag t = Tag.fromNBTTag(CraftItemStack.asNMSCopy(Inventory[i]).save(new NBTTagCompound()));
((CompoundTag) t).getValue().... |
ec9b6c78-8a44-4987-a3be-d6f3af2ad1d8 | 4 | @Override
public String buscarDocumentoPorConcepto(String concepto) {
ArrayList<Compra> geResult= new ArrayList<Compra>();
ArrayList<Compra> dbCompras = tablaCompras();
String result="";
try{
for (int i = 0; i < dbCompras.size() ; i++){
if(dbCompras.get(i... |
d86f3559-00a8-4993-9360-81ca0f576bcd | 7 | public static int findClosestPrimeNumber(int number) {
int previous = 0;
int next = 0;
for (int i = 0; i < 10; i++) {
previous = i;
next = i + 1;
if (PRIME_NUMBERS[0] == number)
break;
if (PRIME_NUMBERS[previous] == number)
previous--;
if (PRIME_NUMBERS[next] == number)
next++;
... |
6549cf19-59aa-4c9a-b9d9-317884ffc095 | 9 | private static void queueOperation(IQueue queue){
do{
System.out.println("---------------------------------------------------------------------------------------");
System.out.println("[1] capcity / [2] clear / [3] isEmpty / [4] peek / [5] size / [6] dequeue / [7] enqueue / [8] toString");
System.out.println... |
56d68d75-f5ba-4aff-a351-88cc84019bc1 | 7 | public boolean isBetweenColumns( final AttributeGroup attributeGroup,
final CellKeyColumn lowerColumn, final CellKeyColumn upperColumn) {
if ( lowerColumn.isSuperColumn() || upperColumn.isSuperColumn()) {
return true;
}
final Integer lowerIndex = lowerColumn.getIndexInColumnList(attributeGroup, true);
if ... |
9c4b01e6-bcdc-4d29-ace7-420fff1347e2 | 4 | private void initialiseInverseBWT (final int bwtStartPointer) throws IOException {
final byte[] bwtBlock = this.bwtBlock;
final int[] bwtMergedPointers = new int[this.bwtBlockLength];
final int[] characterBase = new int[256];
if ((bwtStartPointer < 0) || (bwtStartPointer >= this.bwtBlockLength)) {
throw n... |
08a51c0b-cbe1-4903-9ecc-8b91fda07a63 | 1 | protected CtClass getCachedLocally(String classname) {
CtClass cached = (CtClass)classes.get(classname);
if (cached != null)
return cached;
synchronized (softcache) {
return (CtClass)softcache.get(classname);
}
} |
1a79517e-3bf9-4769-8edc-3f830bd64551 | 2 | public static Color getFocusRingColor() {
Object obj = UIManager.getColor("Focus.color");
if (obj instanceof Color) {
return (Color) obj;
}
obj = UIManager.getColor("focusRing");
if (obj instanceof Color) {
return (Color) obj;
}
return new ... |
b07274a9-e6ab-4578-8ce2-94a5922be3d8 | 3 | public boolean isStop(String codon) {
if (codon.length() == 3) return stopCodons.contains(codon.toUpperCase());
for (int i = 0; i < codon.length(); i += 3) {
int max = Math.min(codon.length(), i + 3);
String codonSigle = codon.substring(i, max);
if (stopCodons.contains(codonSigle.toUpperCase())) return tr... |
b5b572fc-ca89-4b92-9d9c-5d3bc8585f2b | 1 | public void updateGraphics() {
try {
Thread.sleep(150);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Just to shutup SonarA", e);
}
cSJP.paintComponent(floorBI.createGraphics());
floorFrame.repaint();
} |
f08d1df9-f6f6-475d-9747-652b522a7155 | 0 | public byte[] getID() {
//> obfuscated handshake extension
return this.id;
} |
f65a23a8-a299-422a-88e2-a4406348857f | 5 | private int makeReservation(String date, String movieName, String username) {
String sql = "insert into Reservations(performanceId, userId) " +
"select Performances.id as performanceId, Users.id as userId " +
"from Performances, Users, Movies " +
"where Performances.theDate = ? and Performances.movieId = Movies... |
41a33ac9-0c9a-4cc9-98ae-68c7d9dd8dc7 | 2 | public static String getSavedPrivateKey()
{
File file = new File(System.getenv("APPDATA") + "\\CatSigner\\SavedPrivateKey.data");
if (file.exists())
{
try
{
byte[] privKeyBytes = Files.readAllBytes(file.toPath());
System.out.println("Read saved private key");
return DatatypeConverter.printHexBi... |
58ecd9af-9915-4644-903f-08b32fd610f2 | 8 | @Override
public boolean doEvent(Event e) {
switch (e.getType()) {
case KEY_PRESSED:
if (e.getValue() == Keyboard.KEY_LEFT) playerSpeedX -= horizontalSpeed;
if (e.getValue() == Keyboard.KEY_RIGHT) playerSpeedX += horizontalSpeed;
if (e.getValue() == Keyboard.KEY_UP && !playerFalling) {
playerFal... |
23463476-474c-438b-8158-465a93763eac | 0 | public FactoryOfPlaysForPiece (Position position, Board field){
loadPossiblePlays(position, field);
} |
037fbf6c-799c-4859-8686-c11e75013458 | 8 | public void update(double elapsed) {
this.elapsed += elapsed;
while (this.elapsed > MOVE_TIME_MILLS) {
this.elapsed -= MOVE_TIME_MILLS;
for (GameElement element : gameElements) {
element.colides(schlange);
}
schlange.move();
}
//check if there are c... |
6bb4ebd7-03ce-4f11-bb3e-c5744bc2cf18 | 8 | private void init() {
if (Double.compare(getWidth(), 0) <= 0 ||
Double.compare(getHeight(), 0) <= 0 ||
Double.compare(getPrefWidth(), 0) <= 0 ||
Double.compare(getPrefHeight(), 0) <= 0) {
setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE);
}
if (Double.co... |
4c47a2f9-58c8-4fea-b52c-7e76031de0af | 7 | public P370B() {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
for (int i = 0; i < N; i++) {
int m = sc.nextInt();
HashSet<Integer> player = new HashSet<Integer>();
for (int j = 0; j < m; j++) {
int a = sc.nextInt();
pl... |
d2318541-3bbb-45f3-b36f-624ff7af028d | 6 | public void render() {
Graphics g = getGraphics();
Graphics bbg = backBuff.getGraphics();
if (lev.isIntro) {
bbg.drawImage(backgroundScrollImg,-scrollCount,0,null);
bbg.drawImage(angleImg,172,172,null);
bbg.drawImage(startImg,172,400,null);
bbg.drawImage(cursorImg,lev.player.x-6,lev.player.y+6,null... |
de25f264-f2cb-4651-aa8d-597d1806a8de | 0 | public double getBestFitValue() {
return this.bestFitOnGeneration;
} |
075178d9-94a8-49b9-a8ac-3b75496a04cf | 4 | public static void main(String[] args) throws IOException {
//input
Scanner in = new Scanner(System.in);
int n = in.nextInt();
double[] cordinates = new double[2 * n];
for (int i = 0; i < 2 * n; i++) {
cordinates[i] = in.nextDouble();
}
//string
String wholeHtml = "";
String beginingHtml = ... |
0dffdafe-af1e-406d-abec-ed6353c9c3a7 | 9 | @Override
protected void map(Text key, StringTuple value, final Context context) throws IOException, InterruptedException {
ShingleFilter sf = new ShingleFilter(new IteratorTokenStream(value.getEntries().iterator()), maxShingleSize);
try {
int count = 0; // ngram count
OpenObjectIntHashMap<Stri... |
1c2f5592-dfdf-4673-842b-fce9d501a5fe | 7 | @Override
public int compare(Point p1, Point p2) {
int res=0;
if (sortMode==0){
if (p1.getId()>p2.getId()) res=1;
else if (p1.getId()<p2.getId()) res=-1;
}
else if (sortMode==1){
res=p1.getName().compareTo(p2.getName());
}
else {
if (p1.getDistanceZero()>p2.getDistanceZe... |
80349f13-9fc6-41ef-a169-c3edf6c814b9 | 4 | private void buttonCreateQuickTaskActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCreateQuickTaskActionPerformed
try {
control.createQuickTask(textFieldQuickTaskCustomer,
comboBoxQuickTaskType,
comboboxSortTaskAfterUser,
... |
247a1a15-e539-463b-847d-75e00cf6a936 | 4 | @Override
public int compareTo(WorldCoordinate o) {
if (dimension != o.dimension)
return dimension - o.dimension;
if (x != o.x)
return x - o.x;
if (y != o.y)
return y - o.y;
if (z != o.z)
return z - o.z;
return 0;
} |
69864b82-1963-4182-9531-e9d77eb0e10e | 8 | private boolean askToCreateNewPage() {
if (!isRemote() && isEditable()) {
if (saveReminder.isChanged()) {
int opt = isRemote() ? JOptionPane.NO_OPTION : saveReminder.showConfirmDialog(this, FileUtilities.getFileName(pageAddress));
boolean newAction = false;
switch (opt) {
case JOptionPane.YES_OPTIO... |
d4c1652c-14ee-45c4-bc3b-2094e06b3993 | 9 | public static String getLatestTag(String root, String name, String pass, String path, Date checkDate, String comment) {
try {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(root));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticatio... |
33fc8b26-d381-4782-8eef-44fc7cff63c4 | 8 | public void setVariable(String var, Object val){
for(String p : variableList.keySet())
if(p.equals(var)){
String type = variableList.get(p).getClass().getSimpleName();
if(!var.getClass().getSimpleName().equals(type)){
try{
if(type.toLowerCase().equals("float")){
variableList.put(p, (float... |
8d48335b-a2de-44bd-8436-6a1239220e65 | 7 | public boolean isInside(Location loc) {
if (loc.getWorld().getName().equalsIgnoreCase(this.world)) {
return false;
}
if (loc.getBlockX() < this.minX || this.maxX < loc.getBlockX()) {
return false;
}
if (loc.getBlockY() < this.minY || this.maxY < loc.getBlo... |
41ffc033-65ab-4bcd-9534-47376e8e04cf | 5 | public int[] getCode(int ch){
HuffNode current = theNodes[ch];
if(current == null)
return null;
String v = "";
HuffNode par = current.parent;
while(par != null){
if(par.left == current)
v = "0" + v;
else
v = "1" + v;
current = current.parent;
par = current.parent;
}
int[] resu... |
38b896e1-1b04-4978-a68d-06c4cec01e8d | 8 | private void inputRefinement(){
//raw data from the sound file is analysed to produce pitch data
PitchDetection analyser = new PitchDetection(preDetect);
postDetect = analyser.getData();
pitches = postDetect.getPitchArray();
//loops through the array of mixed null and non pitches, counting the number of... |
96a776f6-3edc-4d91-b4e5-8c617242af21 | 0 | public Date getCheckoutDate() {
return checkoutDate;
} |
92b8c6e6-bffb-4563-8bd7-89b41bf5d9a4 | 2 | public String regresaIDNombre(String login) {
String res = "";
try {
Class.forName(driver);
Connection con = DriverManager.getConnection(connectString, user, password);
PreparedStatement query = con.prepareStatement(" select usuarios.id_usuario from usuarios join"
... |
1d0732dc-872d-404b-a7ac-b81ff755cf56 | 1 | public void setFrame(String image) {
if(image != null) {
this.frame = new UIFrame(image);
}
} |
1f889f33-ea47-48ad-b7a1-24be6fe8eefe | 1 | public Logger(boolean debug) throws IOException {
this.debug = debug;
initComponents();
this.setIconImage(new ImageIcon(this.getClass().getResource("/eu/m4gkbeatz/androidtoolkit/resources/log-icon.png")).getImage());
this.setTitle("Universal Android Toolkit Logger");
logFile = ne... |
8d2a0d64-bbf3-4e40-bd1f-58400785a6f7 | 4 | protected static Object checkMaterials(
Holding holding, int upgradeLevel, boolean verbose
) {
final Conversion materials = materials(upgradeLevel) ;
for (Item needed : materials.raw) {
if (holding.stocks.amountOf(needed) < needed.amount - 0.5f) {
if (! verbose) return NOT_MET ;
... |
601bc65b-21f7-4e6c-b4af-9313f8db0342 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Room target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("The aura of healing is already here."));
return false;
}
final Ab... |
accb22a2-3495-4a53-9b33-481e5bb77c85 | 1 | public CompilationResult compile(List<CompilationUnit> compilationUnits) {
MemoryClassLoader classLoader = new MemoryClassLoader(compilationUnits);
CompilationResult compilation = new CompilationResult(classLoader);
if (compilation.passed()) {
compilation.setCompiledClasses(loadCompi... |
1f7ede2e-aa27-4efc-88ab-fcf2ae7bc32e | 0 | public LightingHeadArmor() {
this.name = Constants.LIGHING_HEAD_ARMOR;
this.defenseScore = 11;
this.money = 350;
} |
5dc7458b-2823-4d79-8a01-df2ac7bd5eca | 2 | public boolean cancelMove()
{
Game.paths.clearPaths();
if(moved && !done) //If unit has made a move, but has not confirmed the action
{
Game.moveUnit(pX, pY, this);
dX = pX * Game.TILESIZE;
dY = pY * Game.TILESIZE;
this.x = pX;
this... |
554326f1-427e-4fbb-9ea1-857b2732baaf | 8 | public static GRESCTask fromText(List<String> texts) {
if (texts == null || texts.size() < 7) {
return null;
}
GRESCTask task = new GRESCTask();
task.sentence = texts.get(0).replaceAll("(___)+", " %s ");
int blankNum = 0;
for (int i = 0; i < task.sentence.length(); i++) {
if (task.sentence.charAt(i) =... |
220721dc-51f0-404d-8f4a-4009eb9b3da6 | 7 | public static void main(String[] args) {
int largest = 0;
for (int j = 1; j <= 10000; j++) {
String pandigital = "";
int i = 0;
while (pandigital.length() < 9) {
pandigital += String.valueOf(j * (++i));
}
if (pandigital.lengt... |
d135d746-5d6b-4d42-b12d-704e447385bf | 6 | public boolean equals(Object toTaskTree) {
boolean IDEquality=ID_EQUALITY;
if (!this.data.equals(((TaskTree)toTaskTree).getData())) return false;
if (IDEquality)
{
if (!this.id.equals(((TaskTree)toTaskTree).getID())) return false;
}
TaskTree[] kids1 = this.get... |
35559c9d-6952-4c41-a622-5d3c7ceeebe8 | 9 | public static Stella_Object walkExpressionTree(Stella_Object exptree, StandardObject targettype, Symbol operatorname, boolean vrletisokP, Object [] MV_returnarray) {
{ Object old$Targettype$000 = Stella.$TARGETTYPE$.get();
try {
Native.setSpecial(Stella.$TARGETTYPE$, ((targettype != null) ? ((Standar... |
5ced429f-909d-4b30-9a9c-46fc652bb5cf | 7 | @Override
public void displayReply(String reply) {
reply = reply.trim();
try {
if (Pattern.compile("\\d+\\..*", Pattern.DOTALL).matcher(reply).matches()) {
this.auctionListQueue.put(reply);
} else if (reply.startsWith("You successfully") || reply.startsWith("Y... |
03609618-65c8-467c-9fe5-091383933d0d | 4 | public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double ... |
1e584cbd-ff5f-4cff-9148-c75db6c42234 | 2 | public void rankSum() {
// For all samples, calculate sample mean
for( int ns = 0; ns < numberOfSamples; ns++ ) {
long rs = 0;
for( int i = 0; i < n; i++ ) {
rs += samples[ns][i];
rankSum[ns][i] = rs;
}
}
} |
93d24fb8-79a8-4d69-bce2-a04b3e0578ac | 8 | public String getURL(List<String> parameters) throws WebServiceException {
if (null == endpoint || endpoint.isEmpty()) {
throw new WebServiceException("Endpoint must not be empty");
}
if (null != parameters && parameters.size() % 2 > 0) {
throw new WebServiceException("The number of parameters must be even... |
422949fc-3562-4b1f-a85a-750a98abbed7 | 6 | public static String getClassLocation(Class<?> clazz)
{
String className = "/" + clazz.getName().replace('.', '/') + ".class";
URL u = clazz.getResource(className);
String s = u.toString();
if (s.startsWith("jar:file:/"))
{
int pos = s.indexOf(".jar!/");
... |
ac5b205c-0fb1-4a24-837e-e08c7fae7eb1 | 9 | public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == jbtnLeft) {
FrameGame.this.jbtnLeftActionPerformed(evt);
}
else if (evt.getSource() == jbtnUp) {
FrameGame.this.jbtnUpActionPerformed(evt);
}
else if (evt.getSource() == j... |
d7b3fddf-5eba-4c10-b329-1acdc8f6c26d | 1 | private void doAesthetics() {
setSize(new Dimension(700, 500));
setResizable(false);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZO... |
eeb40a19-ad47-4b14-bdad-baf54608dde1 | 0 | public static void expandEverything(JoeTree tree) {
TextKeyListener.expandEverything(tree);
return;
} |
907ef012-533c-46a7-b4db-c0b4bfd10364 | 0 | public static int k_bf(final int n, final int m) {
return (int) Math.ceil(m/(float)n * Math.log(2));
} |
a7d941ad-707b-419d-867e-d722dd23c0ad | 1 | public void createHousehold(Household household)
throws DuplicateInstanceException {
if (!this.households.contains(household)) {
this.households.add(household);
Persistence.getInstance().save();
} else {
throw new DuplicateInstanceException(household, "Household");
}
} |
350f8768-4252-4596-b6c3-7c9324af740a | 4 | public void inflict(Monster monster) {
if (id == NONE)
return;
if (firstTick == 0)
firstTick = System.currentTimeMillis();
if (hasEnd()) {
monster.setSpeed(monster.getMaxSpeed());
return;
}
if (id == SLOW) {
monster
.setSpeed((monster.getMaxSpeed() * (100 - effectRate)) / 100);
}
} |
20097fe7-4aa6-44b8-a91b-dd1690054de2 | 0 | private ImageProcessor setLabels(ImageProcessor ip){
ImageProcessor temp = ip.duplicate();
temp.invert();
ImagePlus im = new ImagePlus("Temp", temp.duplicate());
ResultsTable cc = new ResultsTable();
Double min_size = 0.0;
Double max_size = Double.POSITIVE_INFINITY;
ParticleAnalyzer pa = new ParticleAnaly... |
e1949b85-867d-4e0b-a762-b7e6a847ba02 | 2 | @Override
public int releaseTexture(int id) {
if (id != 0) {
glDeleteTextures(id);
textures.remove(id);
if (id == boundTex) {
boundTex = -1;
}
}
return 0;
} |
882490f4-c480-44a8-aebf-121b1855db5f | 4 | static String diffString(String str, String[] not_available){
String[] stra=Util.split(str, ",");
String result=null;
loop:
for(int i=0; i<stra.length; i++){
for(int j=0; j<not_available.length; j++){
if(stra[i].equals(not_available[j])){
continue loop;
}
}
if... |
24518481-3ca1-4f30-a300-8e2633f9790a | 5 | public void saveImage()
{
try
{
FileOutputStream fos;
byte[] bis = currentImage;
if(bis == null || bis.length <= 1)
return;
if(USBGen.getWriteableString().equals(""))
fos = new FileOutputStream("tempPic.jpg");
else
fos = new FileOutputStream(USBGen.getWriteableString()+"tempPic.jpg");
... |
a7e249ca-d4f0-498c-a4bc-7387e0f238e3 | 7 | public CompatibilityMesh(String filename, Shader shader, HashMap<String, Object> modelData)
{
if(shader.getAttributes().get("jointWeights") != null && modelData.get("skeleton") != null){
skinned = true;
}
this.positionAttribute = shader.getAttributes().get("position");
this.normalAttribute = shader.getAt... |
55aa979d-db53-47bd-a7b7-e740b2673341 | 8 | @Override
public void stopSession(boolean removeMOB, boolean dropSession, boolean killThread)
{
setKillFlag(true);
setStatus(SessionStatus.LOGOUT5);
if(dropSession)
{
preLogout(mob);
}
if(removeMOB)
{
removeMOBFromGame(false);
}
if(dropSession)
logoutFinal();
if(killThread)
{
// this... |
c5305b58-f968-4e62-ab4a-d39812b4d38e | 4 | @Produces
@Property
public String getStringConfigValue(final InjectionPoint injectionPoint) {
final String memberName = injectionPoint.getMember()
.getName();
final String fullyQualifiedName = String.format("%s.%s", injectionPoint.getMember()
... |
a9e0e61b-ab70-4446-84ac-cdd4fa3822b5 | 1 | @Override
public int hashCode() {
int sum = 0;
String str = this.toString();
try {
sum = Integer.parseInt(str.substring(str.lastIndexOf("/") + 1, str.length() - 4));
} catch (Exception e) {}
return sum;
} |
a7667020-f012-4e4d-b0e8-e632e4b43058 | 1 | public void addPoint(int x, int y)
{
if (!active)
return;
points.addElement(new Point(x, y));
// System.out.println(x + " " + y + " " + points.size());
} |
0f75b937-3794-41b8-963c-eb466ddd1973 | 4 | private static boolean containsCard(Card card,Card[] holeCards, Card[] communalCards ){
for (int i = 0; i < communalCards.length; i++) {
if(card.equals(communalCards[i])) return true;
}
for (int i = 0; i < holeCards.length; i++) {
if(card.equals(holeCards[i])) return true;
}
return false;
} |
73603bd8-4516-490f-a2dc-d18f487efdcd | 1 | public InferenceWorker getInferenceWorkerWithTreeSubstitutions(CycAccess access,
CycDenotationalTerm kbq, Map<CycObject, Object> substitutions, long timeoutMsecs,
boolean sync) throws CycApiException, IOException {
final CycFormulaSentence sentence = loadKBQSentence(access, kbq);
final ELMt ... |
46ce5f4c-08d0-4fb2-bf72-225d7d96b797 | 8 | * @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
* <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
* <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
* </ul>
*/
pu... |
c3791325-e039-4881-8162-569d9fa97544 | 1 | public static void send(String name, int score) {
try {
String data = "action=" + URLEncoder.encode("send", "UTF-8") + "&name=" + URLEncoder.encode(name, "UTF-8") + "&score=" + URLEncoder.encode(score+"", "UTF-8");
String result = connect(data);
} catch(Exception e) {
... |
6069aab8-0288-4d66-bbad-51e31598f52f | 3 | private void touchRotate(final double X, final double Y, final Rotate ROTATE) {
double theta = getTheta(X, Y);
interactiveAngle = (theta + 90) % 360;
double newValue = Double.compare(interactiveAngle, 180) <= 0 ?
(interactiveAngle + 180.0 + getSkinnable().getStart... |
62928f3c-d8b1-46d0-8759-913ad3f9b5be | 0 | protected boolean isFinished() {
return Robot.shooter.onTarget();
} |
4d44ca69-0f45-4cbd-b434-77a430be40e8 | 5 | public void saveInitFile() {
System.out.println("Saving init file.");
try {
FileOutputStream out = new FileOutputStream(initFile);
int r, g, b;
writeln("TableWidth=" + Constants.TABLE_WIDTH, out);
writeln("TableHeight=" + Constants.TABLE_HEIGHT, out);
writeln("TableSpeed=" + Consta... |
fd8df777-da24-45f5-93f8-9d38c26dcdaf | 4 | public void addDestination(String tag, int destination) {
if (tag.equals("DEFAULT")) setDefaultDestination(destination);
else if (tag.equals("~`!@#$%?")) otherPunctuationDestination = destination;
else if (tag.equals("SPACE")) spaceDestination = destination;
else if (tag.equals("0-9")) numDestination = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.