code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public synchronized void clearYTextLabels(int scale){
mYTextLabels.get(scale).clear();
}
| Clears the existing text labels on the Y axis. |
@SuppressWarnings("unchecked") @Override public void eSet(int featureID,Object newValue){
switch (featureID) {
case N4JSPackage.NEW_EXPRESSION__TYPE_ARGS:
getTypeArgs().clear();
getTypeArgs().addAll((Collection<? extends TypeRef>)newValue);
return;
case N4JSPackage.NEW_EXPRESSION__CALLEE:
setCallee((Expression)newValue);
return;
case N4JSPackage.NEW_EXPRESSION__ARGUMENTS:
getArguments().clear();
getArguments().addAll((Collection<? extends Argument>)newValue);
return;
case N4JSPackage.NEW_EXPRESSION__WITH_ARGS:
setWithArgs((Boolean)newValue);
return;
}
super.eSet(featureID,newValue);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
protected void assertArrayEquals(Object[] expected,Object[] value){
String message="expected array: " + InvokerHelper.toString(expected) + " value array: "+ InvokerHelper.toString(value);
assertNotNull(message + ": expected should not be null",expected);
assertNotNull(message + ": value should not be null",value);
assertEquals(message,expected.length,value.length);
for (int i=0, size=expected.length; i < size; i++) {
assertEquals("value[" + i + "] when "+ message,expected[i],value[i]);
}
}
| Asserts that the arrays are equivalent and contain the same values |
private Finished(byte[] verifyData,InetSocketAddress peerAddress){
super(peerAddress);
this.verifyData=Arrays.copyOf(verifyData,verifyData.length);
}
| Called when reconstructing byteArray. |
public boolean matchesThisPacket(DatapathId switchDpid,OFPort inPort,Ethernet packet,AllowDropPair adp){
IPacket pkt=packet.getPayload();
IPv4 pkt_ip=null;
TCP pkt_tcp=null;
UDP pkt_udp=null;
TransportPort pkt_tp_src=TransportPort.NONE;
TransportPort pkt_tp_dst=TransportPort.NONE;
if (any_dpid == false && !dpid.equals(switchDpid)) return false;
if (any_in_port == false && !in_port.equals(inPort)) return false;
if (action == FirewallRule.FirewallAction.DROP) {
if (!OFPort.ANY.equals(this.in_port)) {
adp.drop.setExact(MatchField.IN_PORT,this.in_port);
}
}
else {
if (!OFPort.ANY.equals(this.in_port)) {
adp.allow.setExact(MatchField.IN_PORT,this.in_port);
}
}
if (any_dl_src == false && !dl_src.equals(packet.getSourceMACAddress())) return false;
if (action == FirewallRule.FirewallAction.DROP) {
if (!MacAddress.NONE.equals(this.dl_src)) {
adp.drop.setExact(MatchField.ETH_SRC,this.dl_src);
}
}
else {
if (!MacAddress.NONE.equals(this.dl_src)) {
adp.allow.setExact(MatchField.ETH_SRC,this.dl_src);
}
}
if (any_dl_dst == false && !dl_dst.equals(packet.getDestinationMACAddress())) return false;
if (action == FirewallRule.FirewallAction.DROP) {
if (!MacAddress.NONE.equals(this.dl_dst)) {
adp.drop.setExact(MatchField.ETH_DST,this.dl_dst);
}
}
else {
if (!MacAddress.NONE.equals(this.dl_dst)) {
adp.allow.setExact(MatchField.ETH_DST,this.dl_dst);
}
}
if (any_dl_type == false) {
if (dl_type.equals(EthType.ARP)) {
if (packet.getEtherType() != EthType.ARP) return false;
else {
if (action == FirewallRule.FirewallAction.DROP) {
if (!EthType.NONE.equals(this.dl_type)) {
adp.drop.setExact(MatchField.ETH_TYPE,this.dl_type);
}
}
else {
if (!EthType.NONE.equals(this.dl_type)) {
adp.allow.setExact(MatchField.ETH_TYPE,this.dl_type);
}
}
}
}
else if (dl_type.equals(EthType.IPv4)) {
if (packet.getEtherType() != EthType.IPv4) return false;
else {
if (action == FirewallRule.FirewallAction.DROP) {
if (!IpProtocol.NONE.equals(this.nw_proto)) {
adp.drop.setExact(MatchField.IP_PROTO,this.nw_proto);
}
}
else {
if (!IpProtocol.NONE.equals(this.nw_proto)) {
adp.allow.setExact(MatchField.IP_PROTO,this.nw_proto);
}
}
pkt_ip=(IPv4)pkt;
if (any_nw_src == false && !nw_src_prefix_and_mask.matches(pkt_ip.getSourceAddress())) return false;
if (action == FirewallRule.FirewallAction.DROP) {
if (!IPv4AddressWithMask.NONE.equals(this.nw_src_prefix_and_mask)) {
adp.drop.setMasked(MatchField.IPV4_SRC,nw_src_prefix_and_mask);
}
}
else {
if (!IPv4AddressWithMask.NONE.equals(this.nw_src_prefix_and_mask)) {
adp.allow.setMasked(MatchField.IPV4_SRC,nw_src_prefix_and_mask);
}
}
if (any_nw_dst == false && !nw_dst_prefix_and_mask.matches(pkt_ip.getDestinationAddress())) return false;
if (action == FirewallRule.FirewallAction.DROP) {
if (!IPv4AddressWithMask.NONE.equals(this.nw_dst_prefix_and_mask)) {
adp.drop.setMasked(MatchField.IPV4_DST,nw_dst_prefix_and_mask);
}
}
else {
if (!IPv4AddressWithMask.NONE.equals(this.nw_dst_prefix_and_mask)) {
adp.allow.setMasked(MatchField.IPV4_DST,nw_dst_prefix_and_mask);
}
}
if (any_nw_proto == false) {
if (nw_proto.equals(IpProtocol.TCP)) {
if (!pkt_ip.getProtocol().equals(IpProtocol.TCP)) {
return false;
}
else {
pkt_tcp=(TCP)pkt_ip.getPayload();
pkt_tp_src=pkt_tcp.getSourcePort();
pkt_tp_dst=pkt_tcp.getDestinationPort();
}
}
else if (nw_proto.equals(IpProtocol.UDP)) {
if (!pkt_ip.getProtocol().equals(IpProtocol.UDP)) {
return false;
}
else {
pkt_udp=(UDP)pkt_ip.getPayload();
pkt_tp_src=pkt_udp.getSourcePort();
pkt_tp_dst=pkt_udp.getDestinationPort();
}
}
else if (nw_proto.equals(IpProtocol.ICMP)) {
if (!pkt_ip.getProtocol().equals(IpProtocol.ICMP)) {
return false;
}
else {
}
}
if (action == FirewallRule.FirewallAction.DROP) {
if (!IpProtocol.NONE.equals(this.nw_proto)) {
adp.drop.setExact(MatchField.IP_PROTO,this.nw_proto);
}
}
else {
if (!IpProtocol.NONE.equals(this.nw_proto)) {
adp.allow.setExact(MatchField.IP_PROTO,this.nw_proto);
}
}
if (pkt_tcp != null || pkt_udp != null) {
if (tp_src.getPort() != 0 && tp_src.getPort() != pkt_tp_src.getPort()) {
return false;
}
if (action == FirewallRule.FirewallAction.DROP) {
if (pkt_tcp != null) {
if (!TransportPort.NONE.equals(this.tp_src)) {
adp.drop.setExact(MatchField.TCP_SRC,this.tp_src);
}
}
else {
if (!TransportPort.NONE.equals(this.tp_src)) {
adp.drop.setExact(MatchField.UDP_SRC,this.tp_src);
}
}
}
else {
if (pkt_tcp != null) {
if (!TransportPort.NONE.equals(this.tp_src)) {
adp.allow.setExact(MatchField.TCP_SRC,this.tp_src);
}
}
else {
if (!TransportPort.NONE.equals(this.tp_src)) {
adp.allow.setExact(MatchField.UDP_SRC,this.tp_src);
}
}
}
if (tp_dst.getPort() != 0 && tp_dst.getPort() != pkt_tp_dst.getPort()) {
return false;
}
if (action == FirewallRule.FirewallAction.DROP) {
if (pkt_tcp != null) {
if (!TransportPort.NONE.equals(this.tp_dst)) {
adp.drop.setExact(MatchField.TCP_DST,this.tp_dst);
}
}
else {
if (!TransportPort.NONE.equals(this.tp_dst)) {
adp.drop.setExact(MatchField.UDP_DST,this.tp_dst);
}
}
}
else {
if (pkt_tcp != null) {
if (!TransportPort.NONE.equals(this.tp_dst)) {
adp.allow.setExact(MatchField.TCP_DST,this.tp_dst);
}
}
else {
if (!TransportPort.NONE.equals(this.tp_dst)) {
adp.allow.setExact(MatchField.UDP_DST,this.tp_dst);
}
}
}
}
}
}
}
else {
return false;
}
}
if (action == FirewallRule.FirewallAction.DROP) {
if (!EthType.NONE.equals(this.dl_type)) {
adp.drop.setExact(MatchField.ETH_TYPE,this.dl_type);
}
}
else {
if (!EthType.NONE.equals(this.dl_type)) {
adp.allow.setExact(MatchField.ETH_TYPE,this.dl_type);
}
}
return true;
}
| Checks if this rule is a match for the incoming packet's MatchFields |
public boolean isResizeInProgress(){
return resizeStarted;
}
| Returns whether actual resizing has taken place. |
@Override public AsyncFuture<Void> transform(Void result) throws Exception {
return sink.stop();
}
| Stop the underlying sink. |
protected Boolean isMaxMessageSizeExceeded() throws MessagingException {
Boolean isMaxMessageSizeExceeded;
if (null == (isMaxMessageSizeExceeded=isMaxMessageSizeExceededBasic())) {
updateMaxMessageSizeExceeded();
return isMaxMessageSizeExceeded();
}
return isMaxMessageSizeExceeded;
}
| Returns the maxMessageSizeExceeded, lazily initialised as required. |
@Override public int size(){
return super.size() + ((this.buffer == null) ? 0 : this.buffer.size());
}
| the number of BLOBs in the heap |
@Override public int compareTo(BerkeleyLocation that){
if (this == that || this.equals(that)) return 0;
if (this.getStart() != null && that.getStart() != null) {
if (this.getStart() < that.getStart()) return -1;
if (this.getStart() > that.getStart()) return 1;
}
if (this.getEnd() != null && that.getEnd() != null) {
if (this.getEnd() < that.getEnd()) return -1;
if (this.getEnd() > that.getEnd()) return 1;
}
if (this.getEnvelopeStart() != null && that.getEnvelopeStart() != null) {
if (this.getEnvelopeStart() < that.getEnvelopeStart()) return -1;
if (this.getEnvelopeStart() > that.getEnvelopeStart()) return 1;
}
if (this.getEnvelopeEnd() != null && that.getEnvelopeEnd() != null) {
if (this.getEnvelopeEnd() < that.getEnvelopeEnd()) return -1;
if (this.getEnvelopeEnd() > that.getEnvelopeEnd()) return 1;
}
if (this.getHmmStart() != null && that.getHmmStart() != null) {
if (this.getHmmStart() < that.getHmmStart()) return -1;
if (this.getHmmStart() > that.getHmmStart()) return 1;
}
if (this.getHmmEnd() != null && that.getHmmEnd() != null) {
if (this.getHmmEnd() < that.getHmmEnd()) return -1;
if (this.getHmmEnd() > that.getHmmEnd()) return 1;
}
if (this.getScore() != null && that.getScore() != null) {
if (this.getScore() < that.getScore()) return -1;
if (this.getScore() > that.getScore()) return 1;
}
if (this.geteValue() != null && that.geteValue() != null) {
if (this.geteValue() < that.geteValue()) return -1;
if (this.geteValue() > that.geteValue()) return 1;
}
throw new IllegalStateException("Trying to compare a BerkeleyLocation that has no state. This: " + this + "\n\nThat: "+ that);
}
| Attempts to sort as follows: <p/> If equal (== or .equals) return 0. Sort on start position Sort on end position Sort on envelope start Sort on envelope end Sort on HmmStart Sort on HmmEnd Sort on Score Sort on Evalue |
boolean isReadyForDisplay(){
if (mRootToken.waitingToShow && mService.mAppTransition.isTransitionSet()) {
return false;
}
return mHasSurface && mPolicyVisibility && !mDestroying&& ((!mAttachedHidden && mViewVisibility == View.VISIBLE && !mRootToken.hidden) || mWinAnimator.mAnimation != null || ((mAppToken != null) && (mAppToken.mAppAnimator.animation != null)));
}
| Like isOnScreen(), but we don't return true if the window is part of a transition that has not yet been started. |
@Override public Document build(String uri) throws ParsingException, ValidityException, IOException {
return build(new InputSource(uri));
}
| Parse from URI. |
private void publishDomain(String domainName,String requestingHostName){
DomainResource domain=loadByForeignKey(DomainResource.class,domainName,clock.nowUtc());
try {
Update update=new Update(toAbsoluteName(findTldFromName(domainName)));
update.delete(toAbsoluteName(domainName),Type.ANY);
if (domain != null) {
deleteSubordinateHostAddressSet(domain,requestingHostName,update);
if (domain.shouldPublishToDns()) {
addInBailiwickNameServerSet(domain,update);
update.add(makeNameServerSet(domain));
update.add(makeDelegationSignerSet(domain));
}
}
Message response=transport.send(update);
verify(response.getRcode() == Rcode.NOERROR,"DNS server failed domain update for '%s' rcode: %s",domainName,Rcode.string(response.getRcode()));
}
catch ( IOException e) {
throw new RuntimeException("publishDomain failed: " + domainName,e);
}
}
| Publish the domain, while keeping tracking of which host refresh quest triggered this domain refresh. Delete the requesting host in addition to all subordinate hosts. |
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:21.316 -0500",hash_original_method="165B5BC520C58D38E1ED3303B481AD06",hash_generated_method="31A30F6585BFDDD1EB1245A8A7351220") final boolean isOwnedBy(AbstractQueuedSynchronizer sync){
return sync == AbstractQueuedSynchronizer.this;
}
| Returns true if this condition was created by the given synchronization object. |
public void clear(float r,float g,float b,float a,double depth){
if (this.geometryBuffer != null) {
this.geometryBuffer.bindFramebuffer(false);
GL11.glClearColor(r,g,b,a);
GL11.glClearDepth(depth);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT);
}
}
| Clears the buffer <p><b>Note:</b> Binds the FBO |
private String highlightField(Query query,String fieldName,String text) throws IOException, InvalidTokenOffsetsException {
TokenStream tokenStream=new MockAnalyzer(random(),MockTokenizer.SIMPLE,true,MockTokenFilter.ENGLISH_STOPSET).tokenStream(fieldName,text);
SimpleHTMLFormatter formatter=new SimpleHTMLFormatter();
MyQueryScorer scorer=new MyQueryScorer(query,fieldName,FIELD_NAME);
Highlighter highlighter=new Highlighter(formatter,scorer);
highlighter.setTextFragmenter(new SimpleFragmenter(Integer.MAX_VALUE));
String rv=highlighter.getBestFragments(tokenStream,text,1,"(FIELD TEXT TRUNCATED)");
return rv.length() == 0 ? text : rv;
}
| This method intended for use with <tt>testHighlightingWithDefaultField()</tt> |
public String toString(){
if (the_symbol() != null) return super.toString() + the_symbol();
else return super.toString() + "$$MISSING-SYMBOL$$";
}
| Convert to a string. |
@Override public boolean eIsSet(int featureID){
switch (featureID) {
case SRuntimePackage.EXECUTION_EVENT__RAISED:
return raised != RAISED_EDEFAULT;
case SRuntimePackage.EXECUTION_EVENT__SCHEDULED:
return scheduled != SCHEDULED_EDEFAULT;
case SRuntimePackage.EXECUTION_EVENT__DIRECTION:
return direction != DIRECTION_EDEFAULT;
}
return super.eIsSet(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public boolean isEmpty(){
return remaining() == 0L;
}
| Is buffer empty |
private List<?> checkValueAndIndex(CompositeData value){
checkValueType(value);
List<?> index=internalCalculateIndex(value);
if (dataMap.containsKey(index)) {
throw new KeyAlreadyExistsException("Argument value's index, calculated according to this TabularData " + "instance's tabularType, already refers to a value in this table.");
}
return index;
}
| Checks if the specified value can be put (ie added) in this <tt>TabularData</tt> instance (ie value is not null, its composite type is equal to row type, and its index is not already used), and returns the index calculated for this value. The index is a List, and not an array, so that an index.equals(otherIndex) call will actually compare contents, not just the objects references as is done for an array object. |
public void test_max_uses_ORDER_BY_not_GT(){
final BigdataValueFactory f=BigdataValueFactoryImpl.getInstance(getName());
final IVariable<IV> org=Var.var("org");
final IVariable<IV> auth=Var.var("auth");
final IVariable<IV> book=Var.var("book");
final IVariable<IV> lprice=Var.var("lprice");
final IConstant<String> org1=new Constant<String>("org1");
final IConstant<String> org2=new Constant<String>("org2");
final IConstant<String> auth1=new Constant<String>("auth1");
final TermId tid1=new TermId<BigdataValue>(VTE.LITERAL,1);
tid1.setValue(f.createLiteral("auth2"));
final IConstant<IV> auth2=new Constant<IV>(tid1);
final IConstant<String> auth3=new Constant<String>("auth3");
final IConstant<String> book1=new Constant<String>("book1");
final IConstant<String> book2=new Constant<String>("book2");
final IConstant<String> book3=new Constant<String>("book3");
final IConstant<String> book4=new Constant<String>("book4");
final IConstant<XSDNumericIV<BigdataLiteral>> price5=new Constant<XSDNumericIV<BigdataLiteral>>(new XSDNumericIV<BigdataLiteral>(5));
final IConstant<XSDNumericIV<BigdataLiteral>> price7=new Constant<XSDNumericIV<BigdataLiteral>>(new XSDNumericIV<BigdataLiteral>(7));
final IConstant<XSDNumericIV<BigdataLiteral>> price9=new Constant<XSDNumericIV<BigdataLiteral>>(new XSDNumericIV<BigdataLiteral>(9));
final IBindingSet data[]=new IBindingSet[]{new ListBindingSet(new IVariable<?>[]{org,auth,book,lprice},new IConstant[]{org1,auth1,book1,price9}),new ListBindingSet(new IVariable<?>[]{org,auth,book,lprice},new IConstant[]{org1,auth1,book2,price5}),new ListBindingSet(new IVariable<?>[]{org,auth,book,lprice},new IConstant[]{org1,auth2,book3,auth2}),new ListBindingSet(new IVariable<?>[]{org,auth,book,lprice},new IConstant[]{org2,auth3,book4,price7})};
price9.get().setValue(f.createLiteral("9",XSD.INT));
price5.get().setValue(f.createLiteral("5",XSD.INT));
price7.get().setValue(f.createLiteral("7",XSD.INT));
final MAX op=new MAX(false,lprice);
assertFalse(op.isDistinct());
assertFalse(op.isWildcard());
op.reset();
for ( IBindingSet bs : data) {
op.get(bs);
}
assertEquals(price9.get(),op.done());
}
| MAX is defined in terms of SPARQL <code>ORDER BY</code> rather than <code>GT</code>. |
protected void walk(Node rootNode,CssSelector cssSelector,List<Node> result){
CssSelector previousCssSelector=cssSelector.getPrevCssSelector();
Combinator combinator=previousCssSelector != null ? previousCssSelector.getCombinator() : Combinator.DESCENDANT;
switch (combinator) {
case DESCENDANT:
JoddArrayList<Node> nodes=new JoddArrayList<>();
int childCount=rootNode.getChildNodesCount();
for (int i=0; i < childCount; i++) {
nodes.add(rootNode.getChild(i));
}
walkDescendantsIteratively(nodes,cssSelector,result);
break;
case CHILD:
childCount=rootNode.getChildNodesCount();
for (int i=0; i < childCount; i++) {
Node node=rootNode.getChild(i);
selectAndAdd(node,cssSelector,result);
}
break;
case ADJACENT_SIBLING:
Node node=rootNode.getNextSiblingElement();
if (node != null) {
selectAndAdd(node,cssSelector,result);
}
break;
case GENERAL_SIBLING:
node=rootNode;
while (true) {
node=node.getNextSiblingElement();
if (node == null) {
break;
}
selectAndAdd(node,cssSelector,result);
}
break;
}
}
| Finds nodes in the tree that matches single selector. |
public static String md5Hash(byte[] data) throws NoSuchAlgorithmException {
return md5Hash(data,data.length);
}
| Returns MD5 hash of given byte array. |
@Override protected void createLabels(){
this.addLabel("(PDF)");
}
| Create labels for the start and end of the path. |
public static <K,V,T>EntryProcessor<K,V,T> wrap(GridKernalContext ctx,@Nullable EntryProcessor<K,V,T> proc){
if (proc == null || proc instanceof EntryProcessorResourceInjectorProxy) return proc;
GridResourceProcessor rsrcProcessor=ctx.resource();
return rsrcProcessor.isAnnotationsPresent(null,proc,GridResourceIoc.AnnotationSet.ENTRY_PROCESSOR) ? new EntryProcessorResourceInjectorProxy<>(proc) : proc;
}
| Wraps EntryProcessor if needed. |
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-18 21:46:35.919 -0400",hash_original_method="048650AFF94B01A571A17F813CE8142B",hash_generated_method="570265486E6BAC8556276C3D4D46AB4B") public boolean dismissPopupMenus(){
boolean result=hideOverflowMenu();
result|=hideSubMenus();
return result;
}
| Dismiss all popup menus - overflow and submenus. |
public void write(AnnotationsWriter writer) throws IOException {
writer.constValueIndex(getValue());
}
| Writes the value. |
public String replaceExactlyOnce(String original){
Matcher matcher=searchPattern.matcher(original);
if (!matcher.find()) {
String msg="Pattern not found!\nTemplate:" + source + "\nPattern:\n"+ searchPattern;
throw new IllegalStateException(msg);
}
StringBuffer sb=new StringBuffer();
matcher.appendReplacement(sb,replacement);
if (matcher.find()) {
String msg="Pattern found more than once!\nTemplate:" + source + "\nPattern:\n"+ searchPattern;
throw new IllegalStateException(msg);
}
matcher.appendTail(sb);
return sb.toString();
}
| Applies the replacement onto this string. Throws exceptions if the searchString ins being found not at all or more than once. |
private JPEGImageIO(){
}
| Prevent instance creation. |
@Override final public boolean isSparql10(){
return false;
}
| Always returns <code>false</code> (response is ignored). |
public static boolean hasNoExplicitBound(final AnnotatedTypeMirror wildcard){
return ((Type.WildcardType)wildcard.getUnderlyingType()).isUnbound();
}
| This method identifies wildcard types that are unbound. |
public static void registerMetadata(MetadataRegistry registry){
if (registry.isRegistered(KEY)) {
return;
}
ElementCreator builder=registry.build(KEY).setContentRequired(false);
}
| Registers the metadata for this element. |
public BusinessObjectData createBusinessObjectDataFromEntity(BusinessObjectDataEntity businessObjectDataEntity){
return createBusinessObjectDataFromEntity(businessObjectDataEntity,false);
}
| Creates the business object data from the persisted entity. |
public InvalidityDate(byte[] encoding) throws IOException {
super(encoding);
date=(Date)ASN1.decode(encoding);
}
| Constructs the object on the base of its encoded form. |
public NameAlreadyBoundException(){
super();
}
| Constructs a new instance of NameAlreadyBoundException. All fields are set to null; |
public static void copyFromTo(final Plan in,Plan out){
out.getPlanElements().clear();
out.setScore(in.getScore());
out.setType(in.getType());
for ( PlanElement pe : in.getPlanElements()) {
if (pe instanceof Activity) {
out.getPlanElements().add(createActivity((Activity)pe));
}
else if (pe instanceof Leg) {
out.getPlanElements().add(createLeg((Leg)pe));
}
else {
throw new IllegalArgumentException("unrecognized plan element type discovered");
}
}
}
| loads a copy of an existing plan, but keeps the person reference |
public boolean update(double value){
boolean changed=false;
if (value < min) {
min=value;
changed=true;
}
if (value > max) {
max=value;
changed=true;
}
return changed;
}
| Updates the min and the max with a new value. |
private List<Entity> extractHashtagsWithIndices(final String text,final boolean checkUrlOverlap){
if (text == null || text.length() == 0) return Collections.emptyList();
boolean found=false;
for ( final char c : text.toCharArray()) {
if (c == '#' || c == FULLWIDTH_NUMBER_SIGN) {
found=true;
break;
}
}
if (!found) return Collections.emptyList();
final ArrayList<Entity> extracted=new ArrayList<Entity>();
final Matcher matcher=Regex.VALID_HASHTAG.matcher(text);
while (matcher.find()) {
final String after=text.substring(matcher.end());
if (!Regex.INVALID_HASHTAG_MATCH_END.matcher(after).find()) {
extracted.add(new Entity(matcher,Entity.Type.HASHTAG,Regex.VALID_HASHTAG_GROUP_TAG));
}
}
if (checkUrlOverlap) {
final List<Entity> urls=extractURLsWithIndices(text);
if (!urls.isEmpty()) {
extracted.addAll(urls);
removeOverlappingEntities(extracted);
final Iterator<Entity> it=extracted.iterator();
while (it.hasNext()) {
final Entity entity=it.next();
if (entity.getType() != Entity.Type.HASHTAG) {
it.remove();
}
}
}
}
return extracted;
}
| Extract #hashtag references from Tweet text. |
public final void init(byte[] params) throws IOException {
if (this.initialized) throw new IOException("already initialized");
paramSpi.engineInit(params);
this.initialized=true;
}
| Imports the specified parameters and decodes them according to the primary decoding format for parameters. The primary decoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists. |
public boolean isSetHostname(){
return this.hostname != null;
}
| Returns true if field hostname is set (has been assigned a value) and false otherwise |
public void reply(SerialReply r){
InputBits.instance().markChanges(r);
}
| Process a reply to a poll of Sensors of one panel node |
public boolean isSubtype(ObjectType type,ObjectType possibleSupertype) throws ClassNotFoundException {
if (DEBUG_QUERIES) {
System.out.println("isSubtype: check " + type + " subtype of "+ possibleSupertype);
}
if (type.equals(possibleSupertype)) {
if (DEBUG_QUERIES) {
System.out.println(" ==> yes, types are same");
}
return true;
}
ClassDescriptor typeClassDescriptor=DescriptorFactory.getClassDescriptor(type);
ClassDescriptor possibleSuperclassClassDescriptor=DescriptorFactory.getClassDescriptor(possibleSupertype);
return isSubtype(typeClassDescriptor,possibleSuperclassClassDescriptor);
}
| Determine whether or not a given ObjectType is a subtype of another. Throws ClassNotFoundException if the question cannot be answered definitively due to a missing class. |
public void changeAbbrWinStreaks(String oldAbbr,String newAbbr){
if (longestWinStreak.getTeam().equals(oldAbbr)) {
longestWinStreak.changeAbbr(newAbbr);
}
if (yearStartLongestWinStreak.getTeam().equals(oldAbbr)) {
yearStartLongestWinStreak.changeAbbr(newAbbr);
}
}
| Change the team abbr of the lognest win streak if the user changed it |
@POST @Path("setting") @ZeppelinApi public Response newSettings(String message){
try {
NewInterpreterSettingRequest request=gson.fromJson(message,NewInterpreterSettingRequest.class);
if (request == null) {
return new JsonResponse<>(Status.BAD_REQUEST).build();
}
Properties p=new Properties();
p.putAll(request.getProperties());
InterpreterSetting interpreterSetting=interpreterFactory.createNewSetting(request.getName(),request.getGroup(),request.getDependencies(),request.getOption(),p);
logger.info("new setting created with {}",interpreterSetting.getId());
return new JsonResponse<>(Status.CREATED,"",interpreterSetting).build();
}
catch ( InterpreterException|IOException e) {
logger.error("Exception in InterpreterRestApi while creating ",e);
return new JsonResponse<>(Status.NOT_FOUND,e.getMessage(),ExceptionUtils.getStackTrace(e)).build();
}
}
| Add new interpreter setting |
public int capacity(){
return data.length;
}
| Gets initial capacity of the list. |
public void clear(){
absoluteReadIndex=0;
relativeReadIndex=0;
relativeWriteIndex=0;
queueSize=0;
}
| Clears the queue. |
@Override public void addComment(String comment){
}
| Adds a comment to the current element of the DOM Document. |
public WhitenedZCA(){
this(50);
}
| Creates a new WhitenedZCA transform that uses up to 50 dimensions for the transformed space. This may not be optimal for any given dataset. |
public static boolean startDocumentPrint(int type,int Record_ID,boolean IsDirectPrint){
return startDocumentPrint(type,Record_ID,null,-1,IsDirectPrint);
}
| Start Document Print for Type. Called also directly from ProcessDialog, VInOutGen, VInvoiceGen, VPayPrint |
public Vector<int[]> computeStartAndEndTimePairs(boolean[] sourceValid,boolean[] destValid,int k){
int startTime=0;
int endTime=0;
boolean lookingForStart=true;
Vector<int[]> startAndEndTimePairs=new Vector<int[]>();
for (int t=0; t < destValid.length; t++) {
if (lookingForStart) {
if (destValid[t]) {
if (t - startTime < k) {
continue;
}
else {
if (sourceValid[t - 1]) {
endTime=t;
lookingForStart=false;
if (t == destValid.length - 1) {
int[] timePair=new int[2];
timePair[0]=startTime;
timePair[1]=endTime;
startAndEndTimePairs.add(timePair);
}
}
else {
startTime++;
}
}
}
else {
startTime=t + 1;
}
}
else {
boolean terminateSequence=false;
if (destValid[t] && sourceValid[t - 1]) {
endTime=t;
}
else {
terminateSequence=true;
}
if (t == destValid.length - 1) {
terminateSequence=true;
}
if (terminateSequence) {
int[] timePair=new int[2];
timePair[0]=startTime;
timePair[1]=endTime;
startAndEndTimePairs.add(timePair);
lookingForStart=true;
if (!destValid[t]) {
startTime=t + 1;
}
else {
startTime=t - k + 1;
}
}
}
}
return startAndEndTimePairs;
}
| This method copied from TransferEntropyCommon (since we may delete this soon) to test simple cases of TransferEntropyCalculatorViaCondMutualInfo.computeStartAndEndTimePairs() (i.e. where l, l_tau and delay are 1.) |
public void addHttpSessionToken(String site,String token){
if (!site.contains(":")) {
site=site + (":80");
}
HttpSessionTokensSet siteTokens=sessionTokens.get(site);
if (siteTokens == null) {
siteTokens=new HttpSessionTokensSet();
sessionTokens.put(site,siteTokens);
}
log.info("Added new session token for site '" + site + "': "+ token);
siteTokens.addToken(token);
unmarkRemovedDefaultSessionToken(site,token);
}
| Adds a new session token for a particular site. |
private static String splitStringLeftParenthesis(String name){
String[] splitname=name.split("-");
if (splitname.length > 1 && splitname[1].startsWith("(")) {
return splitname[0].trim();
}
return name.trim();
}
| Splits a string if there's a hyphen followed by a left parenthesis "-(". |
public float length(){
float x=this.m[0];
float y=this.m[1];
float z=this.m[2];
float result=(float)Math.sqrt(x * x + y * y + z * z);
return result;
}
| \brief Returns: length( this ) |
public void commit(){
info("COMMITting Solr index changes to " + solrUrl + "..");
doGet(appendParam(solrUrl.toString(),"commit=true"));
}
| Does a simple commit operation |
private boolean casHead(HeadIndex<K,V> cmp,HeadIndex<K,V> val){
return UNSAFE.compareAndSwapObject(this,headOffset,cmp,val);
}
| compareAndSet head node |
public long nextSetBit(long index){
assert index >= 0 && index < numBits : "index=" + index + ", numBits="+ numBits;
int i=(int)(index >> 6);
long word=bits[i] >> index;
if (word != 0) {
return index + Long.numberOfTrailingZeros(word);
}
while (++i < numWords) {
word=bits[i];
if (word != 0) {
return (i << 6) + Long.numberOfTrailingZeros(word);
}
}
return -1;
}
| Returns the index of the first set bit starting at the index specified. -1 is returned if there are no more set bits. |
public static void mediumText(TextView textView){
highlightText(textView,R.string.wire__typeface__regular);
}
| Will make all sections of the text in a TextView which have [[ ]] around them medium font. For example "Here [[we]] are [[now]]." would make "we" and "now" medium. |
@Override public void registerPersistentStore(String storeName,Scope scope) throws SyncException {
registerStore(storeName,scope);
}
| Persistent stores are not actually persistent in the mock sync service |
public SelectionOpacityIcon(DrawingEditor editor,AttributeKey<Double> opacityKey,AttributeKey<Color> fillColorKey,@Nullable AttributeKey<Color> strokeColorKey,URL imageLocation,Shape fillShape,Shape strokeShape){
super(imageLocation);
this.editor=editor;
this.opacityKey=opacityKey;
this.fillColorKey=fillColorKey;
this.strokeColorKey=strokeColorKey;
this.fillShape=fillShape;
this.strokeShape=strokeShape;
}
| Creates a new instance. |
private ConversionUtil(){
}
| This class is not meant to be instantiated. |
public void draw(Canvas c,Rect bounds){
final RectF arcBounds=mTempBounds;
arcBounds.set(bounds);
arcBounds.inset(mStrokeInset,mStrokeInset);
final float startAngle=(mStartTrim + mRotation) * 360;
final float endAngle=(mEndTrim + mRotation) * 360;
float sweepAngle=endAngle - startAngle;
mPaint.setColor(mColors[mColorIndex]);
c.drawArc(arcBounds,startAngle,sweepAngle,false,mPaint);
drawTriangle(c,startAngle,sweepAngle,bounds);
if (mAlpha < 255) {
mCirclePaint.setColor(mBackgroundColor);
mCirclePaint.setAlpha(255 - mAlpha);
c.drawCircle(bounds.exactCenterX(),bounds.exactCenterY(),bounds.width() / 2,mCirclePaint);
}
}
| Draw the progress spinner |
synchronized private void initView(final ILocalBTreeView view){
if (view == null) {
throw new AssertionError("View not found? " + this);
}
if (initView) {
return;
}
{
long npartitions;
try {
final IMetadataIndex mdi=resourceManager.getFederation().getMetadataIndex(indexMetadata.getName(),commitTime);
if (mdi == null) {
log.warn("No metadata index: running in test harness?");
npartitions=1L;
}
else {
npartitions=mdi.rangeCount();
if (npartitions == 0) {
log.error("No partitions? name=" + indexMetadata.getName());
}
}
}
catch ( Throwable t) {
if (InnerCause.isInnerCause(t,InterruptedException.class)) {
throw new RuntimeException(t);
}
log.error("name=" + indexMetadata.getName(),t);
npartitions=-1L;
}
this.partitionCount=npartitions;
}
{
final int accelerateSplitThreshold=resourceManager.accelerateSplitThreshold;
if (accelerateSplitThreshold == 0 || partitionCount > accelerateSplitThreshold) {
this.adjustedNominalShardSize=resourceManager.nominalShardSize;
}
else {
final double d=(double)partitionCount / accelerateSplitThreshold;
this.adjustedNominalShardSize=(long)(resourceManager.nominalShardSize * d);
if (log.isInfoEnabled()) log.info("npartitions=" + partitionCount + ", discount="+ d+ ", threshold="+ accelerateSplitThreshold+ ", adjustedNominalShardSize="+ this.adjustedNominalShardSize+ ", nominalShardSize="+ resourceManager.nominalShardSize);
}
}
this.rangeCount=view.rangeCount();
this.percentOfSplit=super.sumSegBytes / (double)adjustedNominalShardSize;
this.tailSplit=this.percentOfSplit > resourceManager.percentOfSplitThreshold && super.percentTailSplits > resourceManager.tailSplitThreshold;
initView=true;
}
| Initialize additional data with higher latency (range count, #of index partitions, the adjusted split handler, etc.). |
int functionSub(int position){
return (position / (maxArity + 1)) * (maxArity + 1);
}
| Computation shared by both function(position, genome) methods. Returns function position that corresponds to the given position. |
public void signAssertion(Document document,String signAlgorithm,String digestAlgorithm,X509Certificate cert,PrivateKey key) throws CertificateException, FileNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException, MarshalException, XMLSignatureException, IOException {
try {
if (Thread.currentThread().getContextClassLoader() == null) {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
}
setIDAttribute(document);
XPath xpath=XPathFactory.newInstance().newXPath();
XPathExpression expr=xpath.compile("//*[local-name()='Assertion']/@ID");
NodeList nlURIs=(NodeList)expr.evaluate(document,XPathConstants.NODESET);
String[] sigIDs=new String[nlURIs.getLength()];
for (int i=0; i < nlURIs.getLength(); i++) {
sigIDs[i]=nlURIs.item(i).getNodeValue();
}
Init.init();
for ( String id : sigIDs) {
signElement(document,id,cert,key,signAlgorithm,digestAlgorithm);
}
}
catch ( XPathExpressionException e) {
e.printStackTrace();
}
}
| Sign assertions in SAML message |
public String modifyHeaderTipText(){
return "When selecting on nominal attributes, removes header references to " + "excluded values.";
}
| Returns the tip text for this property |
public AddItemToCollectionAction(final String quest,final String item,int quantity){
this.questname=checkNotNull(quest);
this.item=checkNotNull(item);
this.quantity=quantity;
}
| Creates a new AddItemToCollectionAction |
private String loadIsPossible(final StackType stackType){
if (this.noticeURL.isEmpty(stackType)) {
return "stack is empty";
}
if (this.workerQueue.remainingCapacity() == 0) {
return "too many workers active: " + this.workerQueue.size();
}
final String cautionCause=this.sb.onlineCaution();
if (cautionCause != null) {
return "online caution: " + cautionCause;
}
return null;
}
| Checks if crawl queue has elements and new crawl will not exceed thread-limit |
public MBankStatementLoader(Properties ctx,int C_BankStatementLoader_ID,String trxName){
super(ctx,C_BankStatementLoader_ID,trxName);
init(null);
}
| Create a Statement Loader Added for compatibility with new PO infrastructure (bug# 968136) |
public DateTime roundHalfEvenCopy(){
return iInstant.withMillis(iField.roundHalfEven(iInstant.getMillis()));
}
| Rounds to the nearest whole unit of this field on a copy of this DateTime. If halfway, the ceiling is favored over the floor only if it makes this field's value even. |
public final void insert(Address addr1,Address addr2,Address addr3){
if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!addr1.isZero());
if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!addr2.isZero());
if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!addr3.isZero());
checkTailInsert(3);
uncheckedTailInsert(addr1);
uncheckedTailInsert(addr2);
uncheckedTailInsert(addr3);
}
| Insert an address triple into the address queue. |
protected NativePointerObject(){
nativePointer=0;
}
| Creates a new NativePointerObject with a <code>null</code> pointer. |
static boolean checkLiteral(IXMLReader reader,String literal) throws IOException, XMLParseException {
for (int i=0; i < literal.length(); i++) {
if (reader.read() != literal.charAt(i)) {
return false;
}
}
return true;
}
| Returns true if the data starts with <I>literal</I>. Enough chars are read to determine this result. |
public NetworkBuilder<N,E> expectedEdgeCount(int expectedEdgeCount){
checkArgument(expectedEdgeCount >= 0,"The expected number of edges can't be negative: %s",expectedEdgeCount);
this.expectedEdgeCount=Optional.of(expectedEdgeCount);
return this;
}
| Specifies the expected number of edges in the graph. |
private void zzScanError(int errorCode){
String message;
try {
message=ZZ_ERROR_MSG[errorCode];
}
catch ( ArrayIndexOutOfBoundsException e) {
message=ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
| Reports an error that occured while scanning. In a wellformed scanner (no or only correct usage of yypushback(int) and a match-all fallback rule) this method will only be called with things that "Can't Possibly Happen". If this method is called, something is seriously wrong (e.g. a JFlex bug producing a faulty scanner etc.). Usual syntax/scanner level error handling should be done in error fallback rules. |
@DSSafe(DSCat.DATA_STRUCTURE) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:08.621 -0500",hash_original_method="36E257E69C92FC5D45CD0DCB007DB07A",hash_generated_method="765263DBB9F52D22742C0677CC4C7BD4") public ListIterator<HDR> listIterator(){
return hlist.listIterator(0);
}
| Get an initialized iterator for my imbedded list |
private String computeOperationString(){
Type returnType=methodDoc.returnType();
String op=returnType.qualifiedTypeName() + " " + methodDoc.name()+ "(";
Parameter[] parameters=methodDoc.parameters();
for (int i=0; i < parameters.length; i++) {
if (i > 0) {
op+=", ";
}
op+=parameters[i].type().toString();
}
op+=")" + returnType.dimension();
return op;
}
| Computes the string representation of this method appropriate for the construction of a java.rmi.server.Operation object. |
public boolean isMiniMapVisible(){
return miniMapVisible;
}
| Indicates if the mini-map is currently visible |
private LoggingEventFieldResolver(){
super();
KEYWORD_LIST.add(LOGGER_FIELD);
KEYWORD_LIST.add(LEVEL_FIELD);
KEYWORD_LIST.add(CLASS_FIELD);
KEYWORD_LIST.add(FILE_FIELD);
KEYWORD_LIST.add(LINE_FIELD);
KEYWORD_LIST.add(METHOD_FIELD);
KEYWORD_LIST.add(MSG_FIELD);
KEYWORD_LIST.add(MESSAGE_FIELD);
KEYWORD_LIST.add(NDC_FIELD);
KEYWORD_LIST.add(EXCEPTION_FIELD);
KEYWORD_LIST.add(TIMESTAMP_FIELD);
KEYWORD_LIST.add(DATE_FIELD);
KEYWORD_LIST.add(THREAD_FIELD);
KEYWORD_LIST.add(PROP_FIELD);
KEYWORD_LIST.add(MARK_FIELD);
KEYWORD_LIST.add(NOTE_FIELD);
}
| Create new instance. |
protected boolean fullTopologicalPredicate(Geometry geom){
boolean result=prepPoly.getGeometry().covers(geom);
return result;
}
| Computes the full topological <tt>covers</tt> predicate. Used when short-circuit tests are not conclusive. |
public StandardPieToolTipGenerator(String labelFormat,Locale locale){
this(labelFormat,NumberFormat.getNumberInstance(locale),NumberFormat.getPercentInstance(locale));
}
| Creates a pie tool tip generator for the specified locale. |
public void write(String key,Bitmap bitmap){
if (key == null || bitmap == null) {
return;
}
synchronized (mDiskCacheLock) {
if (mDiskLruCache != null) {
OutputStream out=null;
try {
DiskLruCache.Snapshot snapshot=mDiskLruCache.get(key);
if (snapshot == null) {
final DiskLruCache.Editor editor=mDiskLruCache.edit(key);
if (editor != null) {
out=editor.newOutputStream(DISK_CACHE_INDEX);
bitmap.compress(DEFAULT_COMPRESS_FORMAT,DEFAULT_COMPRESS_QUALITY,out);
editor.commit();
out.close();
}
}
}
catch ( final IOException e) {
Log.e(TAG,"addBitmapToCache - " + e);
}
catch ( Exception e) {
Log.e(TAG,"addBitmapToCache - " + e);
}
finally {
try {
if (out != null) {
out.close();
}
}
catch ( IOException e) {
}
}
}
}
}
| Adds a bitmap to both memory and disk cache |
protected void parseTagContent(Element element,Reader is) throws IOException {
if ((HTMLComponent.SUPPORT_CSS) && (htmlC.loadCSS) && (((HTMLElement)element).getTagId() == HTMLElement.TAG_STYLE)) {
CSSElement addTo=CSSParser.getInstance().parseCSSSegment(is,null,htmlC,null);
htmlC.addToEmebeddedCSS(addTo);
return;
}
super.parseTagContent(element,is);
}
| Overrides XMLParser.parseTagContent to enable embedded CSS segments (Style tags) |
protected void prepare(){
ProcessInfoParameter[] para=getParameter();
for (int i=0; i < para.length; i++) {
String name=para[i].getParameterName();
if (para[i].getParameter() == null) ;
else if (name.equals("M_PriceList_ID")) p_M_PriceList_ID=para[i].getParameterAsInt();
else if (name.equals("InvoiceDocumentNo")) p_InvoiceDocumentNo=(String)para[i].getParameter();
else log.log(Level.SEVERE,"Unknown Parameter: " + name);
}
p_M_InOut_ID=getRecord_ID();
}
| Prepare - e.g., get Parameters. |
public APIConnectionException(String message,Throwable e){
super(message,e);
}
| Create APIConnectionException with message and cause. |
public JsonParser createJsonParser(String content) throws IOException, JsonParseException {
Reader r=new StringReader(content);
IOContext ctxt=_createContext(r,true);
if (_inputDecorator != null) {
r=_inputDecorator.decorate(ctxt,r);
}
return _createJsonParser(r,ctxt);
}
| Method for constructing parser for parsing contens of given String. |
public static void closeSession() throws HibernateException {
Session session=(Session)threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
}
| Closes the single hibernate session instance. |
public void registerSingleBiome(BiomeGenBase biome){
registeredSingleBiome.add(biome);
}
| Registers a biome to have a chance to spawn as the only biome on a planet |
public OVector(int c){
vector=new Object[Math.max(defaultCapacity,c)];
}
| Constructs a new vector with the specified capacity. |
private void convertToRGB(float l,float a,float bstar){
if (l < 0) {
l=0;
}
else if (l > 100) {
l=100;
}
if (a < R[0]) {
a=R[0];
}
else if (a > R[1]) {
a=R[1];
}
if (bstar < R[2]) {
bstar=R[2];
}
else if (bstar > R[3]) {
bstar=R[3];
}
if ((lastL == l) && (lastA == a) && (lastBstar == bstar)) {
}
else {
final int indexL=(int)l;
final int indexA=(int)(a - R[0]);
final int indexB=(int)(bstar - R[2]);
final Integer key=(indexL << 16) + (indexA << 8) + indexB;
final Integer value=cache.get(key);
if (value != null) {
final int raw=value;
r=((raw >> 16) & 255);
g=((raw >> 8) & 255);
b=((raw) & 255);
}
else {
final double val1=(l + 16d) / 116d;
final double[] vals=new double[3];
vals[0]=val1 + (a / 500d);
vals[1]=val1;
vals[2]=val1 - (bstar / 200d);
float[] out=new float[3];
for (int j=0; j < 3; j++) {
if (vals[j] >= C3) {
out[j]=(float)(W[j] * vals[j] * vals[j]* vals[j]);
}
else {
out[j]=(float)(W[j] * C1 * (vals[j] - C2));
}
if (out[j] < 0) {
out[j]=0;
}
}
out=cs.toRGB(out);
r=(int)(out[0] * 255);
g=(int)(out[1] * 255);
b=(int)(out[2] * 255);
if (r < 0) {
r=0;
}
if (g < 0) {
g=0;
}
if (b < 0) {
b=0;
}
if (r > 255) {
r=255;
}
if (g > 255) {
g=255;
}
if (b > 255) {
b=255;
}
final int raw=(r << 16) + (g << 8) + b;
cache.put(key,raw);
}
lastL=l;
lastA=a;
lastBstar=bstar;
}
}
| convert numbers to rgb values |
@DSSink({DSSinkKind.SYSTEM_SETTINGS}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:58:41.491 -0500",hash_original_method="F4F7246DD691380E13C09E794F3AA7A8",hash_generated_method="C92D4A1A16E4C726EA5C5C5E2F1389CD") public static String gsm8BitUnpackedToString(byte[] data,int offset,int length,String characterset){
boolean isMbcs=false;
Charset charset=null;
ByteBuffer mbcsBuffer=null;
if (!TextUtils.isEmpty(characterset) && !characterset.equalsIgnoreCase("us-ascii") && Charset.isSupported(characterset)) {
isMbcs=true;
charset=Charset.forName(characterset);
mbcsBuffer=ByteBuffer.allocate(2);
}
String languageTableToChar=sLanguageTables[0];
String shiftTableToChar=sLanguageShiftTables[0];
StringBuilder ret=new StringBuilder(length);
boolean prevWasEscape=false;
for (int i=offset; i < offset + length; i++) {
int c=data[i] & 0xff;
if (c == 0xff) {
break;
}
else if (c == GSM_EXTENDED_ESCAPE) {
if (prevWasEscape) {
ret.append(' ');
prevWasEscape=false;
}
else {
prevWasEscape=true;
}
}
else {
if (prevWasEscape) {
char shiftChar=shiftTableToChar.charAt(c);
if (shiftChar == ' ') {
ret.append(languageTableToChar.charAt(c));
}
else {
ret.append(shiftChar);
}
}
else {
if (!isMbcs || c < 0x80 || i + 1 >= offset + length) {
ret.append(languageTableToChar.charAt(c));
}
else {
mbcsBuffer.clear();
mbcsBuffer.put(data,i++,2);
mbcsBuffer.flip();
ret.append(charset.decode(mbcsBuffer).toString());
}
}
prevWasEscape=false;
}
}
return ret.toString();
}
| Convert a GSM alphabet string that's stored in 8-bit unpacked format (as it often appears in SIM records) into a String Field may be padded with trailing 0xff's. The decode stops at the first 0xff encountered. Additionally, in some country(ex. Korea), there are non-ASCII or MBCS characters. If a character set is given, characters in data are treat as MBCS. |
public FeedFragment(){
setHasOptionsMenu(true);
setRetainInstance(true);
}
| Initialize a new feed fragment. |
@Override public Enumeration<String> enumerateMeasures(){
Vector<String> newVector=new Vector<String>(1);
newVector.add("measureNumRules");
return newVector.elements();
}
| Returns an enumeration of the additional measure names |
public GPathResult parse(final File file) throws IOException, SAXException {
final FileInputStream fis=new FileInputStream(file);
final InputSource input=new InputSource(fis);
input.setSystemId("file://" + file.getAbsolutePath());
try {
return parse(input);
}
finally {
fis.close();
}
}
| Parses the content of the given file as XML turning it into a GPathResult object |
private static <Item extends Comparable>void partition(Queue<Item> unsorted,Item pivot,Queue<Item> less,Queue<Item> equal,Queue<Item> greater){
}
| Partitions the given unsorted queue by pivoting on the given item. |
public Boolean isTcpSegmentation(){
return tcpSegmentation;
}
| Gets the value of the tcpSegmentation property. |
protected SVGOMMetadataElement(){
}
| Creates a new SVGOMMetadataElement object. |
public void scale(int factor){
if (m_icon != null) {
removeAll();
Image pic=m_icon.getImage();
int width=m_icon.getIconWidth();
int height=m_icon.getIconHeight();
int reduction=width / factor;
width-=reduction;
height-=reduction;
pic=pic.getScaledInstance(width,height,Image.SCALE_SMOOTH);
m_icon=new ImageIcon(pic);
m_visualLabel=new JLabel(m_icon);
add(m_visualLabel,BorderLayout.CENTER);
Dimension d=m_visualLabel.getPreferredSize();
Dimension d2=new Dimension((int)d.getWidth() + 10,(int)d.getHeight() + 10);
setMinimumSize(d2);
setPreferredSize(d2);
setMaximumSize(d2);
}
}
| Reduce this BeanVisual's icon size by the given factor |
public static byte[] decode(byte[] source,int off,int len) throws Base64DecoderException {
return decode(source,off,len,DECODABET);
}
| Decodes Base64 content in byte array format and returns the decoded byte array. |
public boolean contains(byte[] object){
for (int i=0; i < hashFuncs; i++) {
if (!Utils.checkBitLE(data,hash(i,object))) return false;
}
return true;
}
| Returns true if the given object matches the filter either because it was inserted, or because we have a false-positive. |
public static void createTable(SQLiteDatabase db,boolean ifNotExists){
String constraint=ifNotExists ? "IF NOT EXISTS " : "";
db.execSQL("CREATE TABLE " + constraint + "\"ALLOPERATORS\" ("+ "\"_id\" INTEGER PRIMARY KEY ,"+ "\"NAME\" TEXT NOT NULL ,"+ "\"THREAD\" TEXT NOT NULL ,"+ "\"DESC\" TEXT NOT NULL ,"+ "\"IMG\" TEXT NOT NULL ,"+ "\"URL\" TEXT NOT NULL ,"+ "\"OPERATORS_ID\" INTEGER,"+ "\"OUTER_ID\" INTEGER);");
}
| Creates the underlying database table. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.